Comments (3)
Perhaps this is a solution to a problem that doesn't exist. If the text in a textbox changes, moving the cursor to the end of the text might not be the end of the world.
I've been thinking about this recently, and while I don't have a full conclusion here, I am considering: what other things in browsers might break arbitrarily by only copying the selection range? For example, there are Input Method Editors (IMEs) for non-English languages that might be affected somehow (I'm not sure how yet, though). I'm just spitballing ideas here, not saying any of this is true.
However, quite a common use-case I can see is validation where the entry of certain characters is forbidden... preserving the cursor position in that case would be essential...
If I understand correctly, you're saying for example an input component which only allows entering a phone number. When the user types a non-number, the value of the input needs to be replaced and thus the cursor would be moved to the end of the input. Is that correct?
from vecty.
When the user types a non-number, the value of the input needs to be replaced and thus the cursor would be moved to the end of the input. Is that correct?
Yup - that's what I had in mind.
For example, there are Input Method Editors (IMEs) for non-English languages that might be affected somehow
You're probably right.
There's a good cursor jumping discussion in the Facebook react repo here: facebook/react#955
from vecty.
I'm going to mark this as WontFix -- but leave the issue open.
I currently think that it is not possible to implement this in a way that truly works properly (without screwing up the selection flow of the user, or breaking IMEs etc.) But I'd like to acknowledge that this is a real issue for users -- including for React users today -- but that it probably isn't solvable with the APIs that browsers expose today. I'm very open to being proven wrong, or seeing a future selection API solve this problem :)
from vecty.
Related Issues (20)
- Add a basic example on usage HOT 5
- allow global panic handler HOT 2
- removeChild crashes if parent node is nil HOT 1
- [feature request] static HTML/CSS components HOT 6
- Examples go.mod file conflict HOT 1
- Add snake videogame example. HOT 4
- question: What is this prop vs. state idea HOT 3
- Instrumenting panic messages HOT 8
- question: initializing rendered HTML nodes via javascript HOT 4
- Porting gopherjs js calls to use with vecty HOT 2
- Document the availability of vecty project template generator HOT 1
- Return type of If function
- prop.Value("") does not produce the correct html on first render
- Vecty needs an official website HOT 10
- The slack invite link in readme is broken
- vecty docs HOT 1
- How to update a rendered element? HOT 10
- Failed Running The Example HOT 8
- Todo MVC example has misleading usage of p.Items HOT 2
- Rerendering List Replaces First ListItem HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vecty.