Comments (14)
we can add a backdrop to every component that is popup like and when the user clicks outside of the component top most component will get closed.
Yeah, that sounds good.
This is a tiny experiment I did and I think it might look promising and allows Infinite nesting without worry like other frameworks.
That's a cool idea and I like it. I can imagine how it would be nicely layered.
from anu.
I found a new way and wanted to validate it with you:
I will use provide & inject to handle js z-index correctly (just for rendering, we still need to handle drawer close on click of select option).
In parent component we will have
zIndexModifier
:// get zIndexModifier from parent component const zIndexModifier = inject('zIndexModifier', 0) // Increase zIndexModifier by 10 and add current component's zIndex const zIndex = zIndexModifier + 10 + 6 provide('zIndexModifier', zIndex)Now on child component like select we will have the same code:
// provide is not needed in select. Hence we can also omit adding 10 to zIndexModifier const zIndexModifier = inject('zIndexModifier', 0) const zIndex = zIndexModifier + 4According to this assuming new z-index for current docs:
6 drawer 5 navbar 4 menu 4 select
Now for the drawer, we will have 16 z-index and for select inside it, we will have (16 + 10 = ) 26 z-index. However, if select isn't inside drawer its z-index will be 14 as normal below drawer π
Next, when we click on any select option it will close the drawer. For this we will need to assign dynamic id to each drawer and using the
.closest
we can omit closing the drawer.This is a tiny experiment I did and I think it might look promising and allows Infinite nesting without worry like other frameworks.
Off to bed. Please let me know your thoughts on this.
Following this approach, I made this PR to fix the problem.
from anu.
Maybe we need to use use inline style for z-index based on some strategy. E.g. increase z-index if opened inside drawer.
Do you have any good idea?
from anu.
Maybe add some name
property to the ADrawer
component and in ASelect
use closest() method to see if is ASelect
inside the ADrawer
?
from anu.
Looks promising, just have to confirm if this will search in virtual DOM and don't modify/touch the existing DOM.
However, Select & Drawer at the moment are siblings not parent-child.
from anu.
Unfortunately, I have no idea how to verify that DOM will not be touched during the search.
I thought Select is a descendant of Drawer and only his options are teleported into the body and thus siblings.
from anu.
Yes! Only select's options/dropdown is teleported π―
from anu.
I checked other frameworks and they just give too much z-index to select and it overlaps on the navbar like below:
from anu.
Tonight I will check how others doing this and will let you know about the solution.
if you have anything to share please let me know.
from anu.
All I can think of now is:
- set a large z-index
- conditionally increase the index using in-line style
- conditionally change the teleport target (which would also solve #45 )
from anu.
I found a new way and wanted to validate it with you:
I will use provide & inject to handle js z-index correctly (just for rendering, we still need to handle drawer close on click of select option).
In parent component we will have zIndexModifier
:
// get zIndexModifier from parent component
const zIndexModifier = inject('zIndexModifier', 0)
// Increase zIndexModifier by 10 and add current component's zIndex
const zIndex = zIndexModifier + 10 + 6
provide('zIndexModifier', zIndex)
Now on child component like select we will have the same code:
// provide is not needed in select. Hence we can also omit adding 10 to zIndexModifier
const zIndexModifier = inject('zIndexModifier', 0)
const zIndex = zIndexModifier + 4
According to this assuming new z-index for current docs:
6 drawer
5 navbar
4 menu
4 select
Now for the drawer, we will have 16 z-index and for select inside it, we will have (16 + 10 = ) 26 z-index. However, if select isn't inside drawer its z-index will be 14 as normal below drawer π
Next, when we click on any select option it will close the drawer. For this we will need to assign dynamic id to each drawer and using the .closest
we can omit closing the drawer.
This is a tiny experiment I did and I think it might look promising and allows Infinite nesting without worry like other frameworks.
Off to bed. Please let me know your thoughts on this.
from anu.
Oh, i forgot .closest cant find sibling.
Have to find another way to prevent closing.
from anu.
we can add a backdrop to every component that is popup like and when the user clicks outside of the component top most component will get closed.
E.g. When you open select inside drawer click outside of select will close the select and not drawer as we clicked on backdrop of select. We will remove onclickoutside composable usage.
from anu.
I also created another PR to fix the issue where ADrawer close event would be affected by other components.
from anu.
Related Issues (20)
- feat: chip closable advance HOT 2
- Styles are not loaded in the latest Nuxt HOT 7
- [docs] Components such as Select and Radio in the document cannot interact HOT 1
- svelte support HOT 1
- nuxt - anu-vue/volar HOT 3
- update vueuse peerDependencies
- WARN [unocss] include option is deprecated, use content.pipeline.include instead. HOT 2
- Tabs border does not respond to window size change HOT 1
- [unocss] include option is deprecated, use content.pipeline.include instead. But, I didn't use include.
- Colors broken with UnoCSS v0.57 HOT 7
- Have a Bug in the switch component? HOT 3
- typescript types errorοΌ HOT 2
- π€Ήπ»ββοΈ Framework stability in Vue Ecosystem & my vision HOT 4
- update vue peerDependencies HOT 1
- How the selection box sets the properties of the display HOT 1
- [Select] Feature request: Groups for the select element
- v1
- List component unusable with TypeScript HOT 4
- ADatatable : event on clicked / hovered
- Style conflict vitepress HOT 2
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 anu.