-
Notifications
You must be signed in to change notification settings - Fork 58
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
Accept more than one container in which to look for tabbable nodes #10
Comments
@ZhihaoJia Interesting ... Can this be achieved by looking for tabbable nodes in a container that wraps both container1 and container2? Those sound like some wacky examples, and the idea of bouncing focus across various modals sounds confusing to me. Maybe I'm not envisioning the right UI. Keep in mind that tabbable is supposed to list the nodes that you would actually focus as you tab through the container. If you tab through your container and come across a node order different from what tabbable returns, there's a bug. But if you want to use tabbable to get some kind of alternate order, different from what tabbing actually does, that's out of scope. Does this apply to your use-cases? |
@davidtheclark Yep, it could totally be achieved using the method you mentioned! That is, looking for tabbable nodes in the closest common ancestor (with I didn't explain the use cases I was envisioning well though, so let me give that another try. The composite modal case I mentioned doesn't have as much to do with multiple modals as overlaying UI components originating from modals. This is getting into the weeds, but suppose we have a dropdown close to the bottom of a modal. The modal content is scrollable (vs say having a long modal that scrolls with the page). On opening the dropdown menu, suppose we want it to extend below the modal dialog. If the menu were a child of the modal, it might cause the scrollable content to increase (e.g. causes a scrollbar to appear). With For the second use case, suppose we have a modal, except instead of the standard floating rectangle we have a panel that slides in from the side. Suppose we also have a nav bar along the top of the page and we don't want to cover the nav bar with the panel. In that case, we may want to get the tabbable nodes in both the nav bar and modal panel, while excluding tabbable nodes on the rest of the page. Anyway, I think |
Thanks for clarifying @ZhihaoJia! Makes sense. |
It'd be nice to be able to pass more than one element to
tabbable
. The currenttabbable
doesn't allow us to easily find the relative tab orders of elements in multiple containers, if we were to calltabbable
on each container.Would it be reasonable to add this feature to
tabbable
? Happy to send a pull request if that's okay.Example:
Suppose the numbers following "el" represent the tab orders of focusable the elements...
container1: el1, el4, el3
container2: el2, el5, el6
Calling
tabbable
oncontainer1
andcontainer2
would give us...container1: el1, el3, el4
container2: el2, el5, el6
However, we wouldn't know how to combine the two lists of
el
s, or know thatel2
fromcontainer2
should be tabbed to beforeel3
fromcontainer1
.Proposal
Allow
tabbable
to accept multiple elements:tabbable(el1, el2, ...)
.tabbable
returns an array of tabbable nodes in tab order from all of the passed elements/nodes.Use cases
The text was updated successfully, but these errors were encountered: