Coder Social home page Coder Social logo

Comments (1)

alexlafroscia avatar alexlafroscia commented on May 26, 2024

I was thinking about service injected to all dialogs, then when a component is mounted, the dialog is registered in service.

I think that this would be the way to go. We can use a service to store a stack of open Dialog components that is pushed to/popped from when Dialog components are mounted/unmounted. We know that a given Dialog is the "active" one if it's at the head of the stack; not being the active one will require disabling the focus trap, among other things. I think I saw a library that implements a tracked Stack class... I'll have to try to find it!

The issue that I see with yielding a Nested component is that most of the ways I would see nesting of dialogs happening, one instance won't actually know about another. I could see a component that happens to use a modal itself being rendered inside of another modal, where the "inner" and "outer" aren't connected in any way.

I am quite curious about what a good solution around providing the information to the template about whether the Dialog is active or not...

Since the React and Vue implementations don't do anything here, maybe we shouldn't either, even though we could? I would rather not provide an API initially and later introduce something than introduce something up front that we ultimately regret. I think leaning on the behavior of the official API, if in doubt, is a good idea.

from ember-headlessui.

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.