I have a simple form containing rich text box. When trying to navigate using the cursor keys from it beeps if the caret can't be moved - for example, pressing Home key when the caret is already on start of line, or trying to move line up when the caret is already on top line. Is there a way to disable those beeps?
If you want to disable the ding (beeps) noise from being triggered each time when you press cursor keys or home key, then unfortunately it doesn't seems to be possible. But yeah, you can do it in some specific ways (i.e. using AcceptButton, CancelButton form property described in this SO thread.
Related
i am coding a Dialog component, and it will allow to close by pressing the Esc key on the keyboard and it works fine.
The problem I have is when using multiple Dialogs on top of each other, when I press Esc they all get closed while I just want to close the top Dialog one by one.
The point is know the dialog isOnTop or isNotOnTop and blocking keyboard event. I have tried using props drilling to check if DialogB is opened then DialogA isNotOnTop and prevent to closing but with more complex components this method seems difficult.
Can anyone give me some suggestions on how to implement my idea in a better way? I'm a newbie with reactjs, thanks.
This is how the idea looklike: youtube
Below code is written on codesanbox.
I played around a bit. I used zustand.js to store all the opened dialogs.
Every dialog has its own identifier/index. When pressing ESC the dialog checks the open dialogs in the store against its own identifier, like that only the last dialog closes. I used a Set(), so the dialogs are always unique.
I hope that helps.
Here's your modified sandbox.
edit:
(Answering your comment)
This happens because right now the code checks the identifier against the size of the Set. To fix replace this line
if (dialogs.size === identifier && event.keyCode === escapeKeyNumber) {
with
if ([...dialogs].pop() === identifier && event.keyCode === escapeKeyNumber) {
this compares the last entry of the set with the identifier instead of the size of the set.
modified sandbox
I hope that someone responds to very elementary questions as well as the difficut ones. It's more than oe months that i use Ride for RobotFramework and i could never use the Search button on Text editor tab of Ride.
i write a word (not keyword) and i click the search button ( not Apply Changes button) and nothing happens. is it normal?
Thanks for any insight
The Search Button expects to have the text box on its left filled with the words to search.
You can also select the text and press Ctrl-G that will fill the text box an start the search (from the top of the file). Shift-Ctrl-G does the same but backwards.
This is a very rudimentary search function, but allows to find and replace if you have previously put content in memory (Ctrl-C), you can Search and then Ctrl-V.
It is common practice in many UI situations to preselect the text displayed in a text editing field in such a way that if the user starts typing it immediately replaces the displayed text.
This can be useful for example in search field to show the previously searched text (for reuse or editing) while making it easy to search for a new text string simply by start typing.
I've searched for how to do this in TextField, but not found a way yet - is it possible?
We don't have a concept of pre-select and it isn't common in mobile where selection is awkward by comparison. A more common approach here is to have an X button next to the text field which clears the text field instantly. You can easily do it by just adding a button next to the field.
I have an editor that is supposed to have entities with the props name, color, start, end. In the editor the text in positions denoted by start and end will be subsistuted by name, and it will be rendered by a custom component with contentEditable=false.
This works great with draftjs in general but there are a couple of issues:
When moving the cursor with the keyboard arrows, the entities are skipped over, which is good. But when an entity is at the very end of the input and I try to move rightwards past it (either just with right arrow or with option or cmd + right) the cursor disappears and doesn't come back when I move left again.
If I go right to the left of an entity and push shift + option + right arrow, the entity is selected as expected. But if I then press left arrow the cursor is also lost.
I could fix this by making sure there is always a whitespace after such a last entity, but that seems hacky and probably has edge cases.
Another option is to not use contentEditable=false, but that creates other issues with my actual app, which has a more complicated entity component including a dropdown, and I will have to manually make sure the user can't change text inside the entities etc.
Here is a reproduction of the issue: https://codesandbox.io/s/competent-surf-st77i
Any ideas?
My cursor is right where it needs to be in my text editor - visually. When I continue typing from the keyboard - nothing is shown. The cursor is in the browser (when I press up-down arrow keys from the keyboard - the browser page is moved up/down). I need to click on the text editor so that I can continue typing. Even though the cursor is visible and blinking in the text editor. I use tinymce and ie9. (I use ie9 just for testing purposes, I'm not crazy).
When I execute:
document.activeElement
it returns that an iframe element has focus, and not the text area.