Comments (6)
Hey @gjrevans can you post a codepen or something showcasing the issue?
I think the appending of the background makes sense and is probably the way to do it, but we may also have to dynamically generate the modal down there too, which would be not a simple change.
from tailwindcss-stimulus-components.
Hey @excid3,
Here's a codepen showcasing the issue: https://codepen.io/gjrevans/pen/GVRYMm?editors=0010.
You shouldn't need to dynamically generate the modal. Just ensure the modal's position is set to something other than static (so that it respects z-index) and give it a z-index higher than the modal background which will get dynamically appended at the end of the body.
P.S. A few friends and I ran into this issue while using Jumpstart package you created. We grabbed the pro license as we wanted to give Stimulus / Tailwind a go. Thanks for putting that solution together, it's great!
from tailwindcss-stimulus-components.
Here's a very rudimentary working version with the suggested improvement: https://codepen.io/gjrevans/pen/gVOqxW
I've moved the modal background out of the HTML side of things, created a local variable in the modal controller for modalBackground
and then append & remove it using the open & close actions. I've also updated the closeBackground
function to instead closeContainer
as the background was no longer necessary.
The modal background has a z-index: 40
and the modal container a z-index: 50
(and is position: fixed
and thus it and it's children will respect z-index). Arguably it would be better to assign them much higher z-index values like 1000 and 1010 to ensure they are alway on top of everything -- this could be done inline to avoid creating new classes as you've already done with the transparent background.
from tailwindcss-stimulus-components.
Fantastic, thanks so much. This will be good to have fixed. π
I agree, we may want to use like an inline z-index
specified above the max that Tailwind offers, that way we can make sure it's above any other z-50
items on the page. This may not be an issue, if the z-50
of the background takes precedence since it's the very last item in the DOM. Plus people may customize Tailwind to add like a z-1000
and we'd want to handle that case too ideally.
from tailwindcss-stimulus-components.
Thanks! This is fantastic.
Last night I went and updated everything to work similar to your codepen. I made a few enhancements to allow customizing the backdrop and such.
Just released it as 1.0.0, so hopefully everything is good. This is backwards incompatible because of the HTML changes, hence the major version bump.
from tailwindcss-stimulus-components.
@excid3 thatβs awesome! π Happy it helped, thanks for putting that through so quickly!
from tailwindcss-stimulus-components.
Related Issues (20)
- Permit use Turbo frame on tabs click -Possible solution- HOT 3
- Multiple modals HOT 1
- How to utlize `cb`?
- https://registry.yarnpkg.com/tailwindcss-stimulus-components~: Not found HOT 1
- - delete this is just an error
- Tabs not working with the select / dropdown HOT 1
- Navigable Tabs with Keyboard HOT 1
- New release? HOT 4
- Active tabs styling is broken in version 4 HOT 2
- Modal forced to the hidden state when added to the DOM HOT 4
- Specify prefix for tailwind classes HOT 2
- Issue when using `data-tabs-update-anchor-value="true"` and linking to a specific anchor from another page HOT 1
- Dropdown improvements HOT 4
- Google Chrome Autofill Result Select Causes Modal Close HOT 3
- Multiple modals on a page -- components not properly behind background HOT 1
- Uncaught (in promise) DOMException: The user aborted a request. HOT 1
- CDN Minified version does not appear to respect `data-toggle-class` for toggle HOT 2
- Toggle feature cannot have multiple divs to have different status
- new release
- Dropdown transition are not working
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tailwindcss-stimulus-components.