Git Product home page Git Product logo

Comments (3)

davidtheclark avatar davidtheclark commented on June 27, 2024

@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?

from tabbable.

ZhihaoJia avatar ZhihaoJia commented on June 27, 2024

@davidtheclark Yep, it could totally be achieved using the method you mentioned! That is, looking for tabbable nodes in the closest common ancestor (with tabbable) and filter for the ones inside either container1 or container2. This would cover my use cases, which I think would admittedly be pretty niche.

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 overflow: hidden on the modal, we would not see the full menu. With overflow: visible, we wouldn't be able to make the modal contents scrollable. So instead we move the menu outside of the modal in the DOM. However, calling tabbable on the modal would no longer include the tabbable nodes in the menu.

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 tabbable would still work for both cases so it's not a big deal. It's really just for convenience. :)

from tabbable.

davidtheclark avatar davidtheclark commented on June 27, 2024

Thanks for clarifying @ZhihaoJia! Makes sense.

from tabbable.

Related Issues (20)

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.