GithubHelp home page GithubHelp logo

phuocng / mirror-a-text-area Goto Github PK

View Code? Open in Web Editor NEW
48.0 3.0 4.0 8.84 MB

Enhancing user experience through text area mirroring

Home Page: https://phuoc.ng/collection/mirror-a-text-area/

License: MIT License

HTML 100.00%
dom-manipulation javascript

mirror-a-text-area's Introduction

Hey, I'm Phuoc Nguyen! ๐Ÿ‘‹

I'm a software engineer from Vietnam ๐Ÿ‡ป๐Ÿ‡ณ.

In my free time, I enjoy playing football โšฝ with my co-workers and Nintendo games ๐ŸŽฎ with my kids.

I also take care of my Border Collie ๐Ÿ•. Here's a little secret: my zodiac sign is the dog.

I hope you find useful things in this digital space ๐Ÿš€.

Collections ๐Ÿš€

Check out this list of series that cover various topics in front-end development. They're incredibly useful for both learning and your day-to-day work, just like they are for me.

Best of all, they're all free and open to contributions. If you find them helpful, please consider giving them a GitHub star ๐Ÿ˜. Your support is greatly appreciated!

My top JavaScript utilities, in just One Line of Code!

Common ways to solve cross-browser compatibility problems

Awesome CSS animations: examples of stunning animations without external libraries

A collection of popular CSS layouts and patterns that you can use right away

Front-End development mastery: simple tips, tricks, and best practices

Mastering DOM manipulation with vanilla JavaScript

Understanding the difference between หหห and หหห in front-end development

In-depth series ๐Ÿงช

Are you a front-end engineer looking to take your skills to the next level? Then you're in luck! I'm excited to present to you our in-depth series covering advanced techniques and patterns in front-end development.

Our series is designed to provide you with real-life examples that you can use for your applications. We understand that learning can be a daunting task, which is why we've curated our content to be both engaging and informative. You won't find any boring material here!

In this series, we'll cover a range of topics, including advanced CSS, JavaScript, as well as popular front-end libraries. Our goal is to help you become a more well-rounded and skilled front-end developer.

It's important to follow the posts in the correct order, starting from the first one and working your way to the last. There are some important techniques introduced in between that you won't want to miss.

Enhancing user experience through text area mirroring

Your complete guide to mastering the use of "ref" in React

Master the art of drag and drop in React

Questions? ๐Ÿ™‹

Do you have any questions about front-end development that you'd like to learn more about? Shoot me a message on Twitter or assign me a new issue.

I've got a long list of upcoming posts, but I want to make sure I'm covering the topics that you're most interested in. Let's learn together! Sharing knowledge is the best way to grow in this field ๐Ÿฅท.

Contact

mirror-a-text-area's People

Contributors

phuocng avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

mirror-a-text-area's Issues

Empty lines at the bottom of the scrolled area break the mirroring

(Hi. Thank you for putting all these interesting articles together.)
I believe there's an issue with the mirroring from the first article, and this issue find its way in the next parts as well.
Although you're setting the scrollTop of the mirrored div to the scrollTop of the textarea on scroll, it's still going out of sync for some reasons once one or more empty new lines are entered at the bottom of the textarea.
Here's a screenshot of the issue:
image
I just typed a few more "you\n\n"s so that the area gets a scrollbar, and then I scrolled up a bit.
I don't know why this is happening yet, but it's obviously not expected.
I've encountered and reproduced this in my own code too, when I was trying your first article (just doing the mirroring). I just used a red color (any color other than transparent works as well) instead of transparent, and it's in sync on scroll, however, as soon as I entered a newline at the last line, it went out of sync.
image
image

Displayed line numbers don't remain aligned with their corresponding text on mobile

These are screenshots of the issue:
photo1705526781_cr
photo1705526843_cr

I guess the root of this issue is related to the other issue I opened here: #11 Because this is again happening towards the end of the textarea. I.e., if I start from top and go towards the bottom, line numbers remain aligned for most of the path, however, as soon as it gets to the last lines, the line numbers don't move up with the scrolled lines anymore (which is in my opinion, very similar to what happened in the last issue I opened.)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.