-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[tabindex] use tab to cycle through inputs #3302
Conversation
keeps buttons from focusing by using TAB if no tabindex is given
keeps links from focusing by using TAB
this passes the tabindex to simple.js/framed.js/codemirror-engine
this allows TAB to cycle through input fields in the order of the DOM structure when no other tabindex is specified sets tabindex "0" by default
Now the engines cancel popups on focus before they trigger new popups |
Now I don't know how you want to handle tabindices of |
I could also address #3237 with this PR |
Annoyingly, I didn't leave enough crumbs to figure out my original thinking, but it would certainly be good to sort it out. It's one of those cases where we need to take great care to test in all browser configurations (the fudge factor could have been to prevent scroll bars appearing, for instance). |
I'm not able to test in all browsers. We should create another PR for that |
I develop on macOS and so can easily test in Firefox, Safari, Chrome and Opera. I use Windows virtual machines to test IE and Edge (the VMs are free these days from MS). Depending on your OS you may not be able to cover as many browsers as that but it is important that we test UI-impacting changes as broadly as possible. If you're not able to achieve broad coverage yourself then make a note in the PR; I tend to assume that contributors have tested PRs (I'm an optimist 😄) |
pretty optimistic 😁 setting up vm's is no big deal - but for macOS it is if you don't have the license. That said, you can assume that I don't test Safari.. When I have time I will take a look at this 14px thing on various browsers. If someone else does, even better 👍 But I'd like to move it back to the original issue (#3237) because it apparently needs more than just removing it |
all input widgets and the link widget now have their tabindices:
I'd like to ask @Jermolene @pmario first what you prefer as default tabindex |
... making all links, buttons, checkboxes etc tabindex="1" will first focus all inputs and textareas (tabindex="0") and then go to those with tabindex 1 we could even set an index on the tiddler frames to navigate from a tiddler to the next with I don't know how to proceed because of these decisions and will wait with this |
if(this.widget.editTabIndex) { | ||
this.iframeNode.setAttribute("tabindex",this.widget.editTabIndex); | ||
} else { | ||
this.iframeNode.setAttribute("tabindex","0"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not happy!
domNode.setAttribute()
is an "expensive" function. ... So if we can avoid to call it, we definitely should. The else path now makes this action mandatory for every dom element, even if a user doesn't use it.
personal rant ;)
The point is. I personally don't care about the tab order, because it will always be wrong. ... And using the "tab-key" to navigate input elements is similar to the "original sin" introduced by MS.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, the original cause of this is that one can jump from the title field to the tag input to the text editor with TAB
without focusing the buttons in between
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
domNode.setAttribute() is an "expensive" function. ... So if we can avoid to call it, we definitely should
Ok
The else path now makes this action mandatory for every dom element, even if a user doesn't use it.
why for every dom element?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why for every dom element?
ok. every DOM element that can get input focus. ...
eg: Links already create the biggest UI stutter we have at the moment. Just switch between the shadow and system sidebar tabs. IMO this change will make it worse.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wanted to discuss if tabindices should or should not be set for links, Buttons and so on …
I am very fine with NOT touching them, reverting my changes on those Elements and only giving the Input and text-Areas their Indices so that TAB
works for Jumping between them
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
… do you think calling setAttribute()
within the simple and framed engines is too expensive or are you more concerned About the amount of links and Buttons (for whom I'll most likely remove the tabindex again)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
… do you think calling setAttribute() within the simple and framed engines is too expensive or are you more concerned About the amount of links and Buttons (for whom I'll most likely remove the tabindex again)?
I did comment on the first else ... setAttribute()
line Iine that I saw, because there are several. ...
I'm concerned about the number of elements that are affected by the change.
eg: If you open the right sidebar on tiddlywiki.com and try navigate the TOC structure with the keyboard only! IMO the existing experience is completely broken. ...
Will your PR fix this? If yes good. .... If it only improves the tiddler edit mode, it should be only active in the tiddler edit form and nowhere else. ...
Just my thoughts.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will your PR fix this? If yes good. ....
To know that, I'd need to know how it should behave
I'm concerned about the number of elements that are affected by the change.
your concerns made me see this from a different view. I'm in favor of making this for tiddler edit forms only...
How to check if the input is within a tiddler? Is this.getVariable("storyTiddler") !== undefined
good enough?
Note that I'm going to remove the tabindex for buttons, links, checkboxes etc. and leave it for input and textarea tags only - there I'd check then if we're within a tiddler
Respecting the concerns Mario mentioned I have made a version that sets the tabindex for inputs and textareas within tiddlers only (where storyTiddler is defined) I'm already setting an attribute When this decision is made, I'd like to close this and make a new PR with this simpler version Simon |
I did test your code in tiddler edit mode, as it is at the moment. ... The behaviour there seems to be cleaner as with the 5.1.17 at tiddlywiki.com. ... So I think I'm ok with the changes atm. We still have the problem, that we can't navigate the dropdown elements. But that's probably a completely different topic. |
Thanks @pmario - I'm not going to change that behaviour in edit mode, but you were right with the tabindices on all other elements where it's unnecessary I've seen that it's a delicate tweak and therefor I want to get it right for the original issue first and that's the tiddler in edit mode, jumping from input to input The dropdown items on tiddlywiki 5.1.17 can be focused using tab because input fields and dropdown items have the same default tabindex and the dropdown items come after the input in the DOM structure Now, if I set all inputs and textareas in an edit-tiddler to "1" (I'm testing 1 for inputs locally atm) I can jump between the inputs but the items with lower index-level get "overjumped" as in my current code That, I think, is a new issue that comes with solving the other and we need to decide if we solve the original issue accepting the unfocusable dropdown items or not. I like the new version - I either write tags, type and fieldnames or select them by mouse |
Yea, I think the new behaviour is better, since the old one opens several dropdowns but didn't close them anymore. And they can't be selected with tabs anyway. |
I think so, too I've made a simpler PR - #3309 |
so you may close this one? |
|
This sets the tabindex of buttons and links to "-1" by default so that they get ignored when cycling using
TAB
- see issue #3298Sets the tabindex of
<input>
and<textarea>
elements to "0" by default so that it uses the DOM-structure order when cyclingWith this, one can jump from the title field directly to the tag input field, from the tag input field directly to the text field, from there directly to the type field, to the field name, to the field value ...
custom tabindices for buttons, links and input fields/areas can be set by passing the tabindex as an attribute
the type input-field already cancels its popup automatically when going ahead using
TAB
the popups in the tag input-field and the field-name input-field don't get cancelled - I think they should