-
-
Couldn't load subscription status.
- Fork 1.6k
feat: improvements related to drawer #4215
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
Open
pdanpdan
wants to merge
7
commits into
saadeghi:master
Choose a base branch
from
pdanpdan:feature/drawer-size
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
+69
−61
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- drawer-open will be part of the page content and we do not want it to be forced to screen height (it will participate to general page height) - if we want to force it to screen height we can use `h-screen` on `drawer-side`
…er are both in modifiers layer This allows us to apply style when drawer visibility is checked, and revert-layer later if it is drawer-open. Do not change scrollbar-color if .drawer-open (the scrollbar is part of the page normal flow)
…olllock) This move is good from the POV of css generation because now the styles are auto-generated in case variants are used for drawer-open. This move is not good because now we have styles that concern rootscrolllock in drawer. The best would be if we could move these 2 blocks of code in rootscrolllock and declare them as variants as they are in drawer.
|
I used this as <dialog id="modal_1" class="modal">
<div class="modal-box">
<h3 class="text-lg font-bold">Hello!</h3>
<p class="py-4">Press ESC key or click the button below to close</p>
<div class="modal-action">
<label class="btn btn-ghost" for="show-scroll">
Toggle page scrollbar
</label>
<label class="btn btn-ghost" for="hide-scroll-modal1">
Toggle modal scrollbar
</label>
<form method="dialog">
<!-- if there is a button in form, it will close the modal -->
<button class="btn">Close</button>
</form>
</div>
<input type="checkbox" class="peer hidden" id="hide-scroll-modal1" checked />
<div class="peer-checked:hidden">
<p class="py-4">Line 1</p>
<p class="py-4">Line 2</p>
<p class="py-4">Line 3</p>
<p class="py-4">Line 4</p>
<p class="py-4">Line 5</p>
<p class="py-4">Line 6</p>
<p class="py-4">Line 7</p>
<p class="py-4">Line 8</p>
<p class="py-4">Line 9</p>
<p class="py-4">Line 10</p>
<p class="py-4">Line 11</p>
<p class="py-4">Line 12</p>
<p class="py-4">Line 13</p>
<p class="py-4">Line 14</p>
<p class="py-4">Line 15</p>
<p class="py-4">Line 16</p>
<p class="py-4">Line 17</p>
<p class="py-4">Line 18</p>
<p class="py-4">Line 19</p>
<p class="py-4">Line 20</p>
</div>
</div>
</dialog>
<dialog id="modal_2" class="modal modal-bottom">
<div class="modal-box">
<h3 class="text-lg font-bold">Hello!</h3>
<p class="py-4">Press ESC key or click the button below to close</p>
<div class="modal-action">
<label class="btn btn-ghost" for="show-scroll">
Toggle page scrollbar
</label>
<label class="btn btn-ghost" for="hide-scroll-modal2">
Toggle modal scrollbar
</label>
<form method="dialog">
<!-- if there is a button in form, it will close the modal -->
<button class="btn">Close</button>
</form>
</div>
<input type="checkbox" class="peer hidden" id="hide-scroll-modal2" checked />
<div class="peer-checked:hidden">
<p class="py-4">Line 1</p>
<p class="py-4">Line 2</p>
<p class="py-4">Line 3</p>
<p class="py-4">Line 4</p>
<p class="py-4">Line 5</p>
<p class="py-4">Line 6</p>
<p class="py-4">Line 7</p>
<p class="py-4">Line 8</p>
<p class="py-4">Line 9</p>
<p class="py-4">Line 10</p>
<p class="py-4">Line 11</p>
<p class="py-4">Line 12</p>
<p class="py-4">Line 13</p>
<p class="py-4">Line 14</p>
<p class="py-4">Line 15</p>
<p class="py-4">Line 16</p>
<p class="py-4">Line 17</p>
<p class="py-4">Line 18</p>
<p class="py-4">Line 19</p>
<p class="py-4">Line 20</p>
</div>
</div>
</dialog>
<div class="drawer xl:drawer-open">
<input id="drawer" type="checkbox" class="drawer-toggle" />
<div class="drawer-content">
<div class="p-4">
<div class="navbar bg-base-300 gap-4">
<button class="btn btn-primary" onclick="modal_1.showModal()">
Open Modal
</button>
<button class="btn btn-primary" onclick="modal_2.showModal()">
Open Bottom Modal
</button>
<label class="btn btn-secondary drawer-button" for="drawer">
Open drawer
</label>
<label class="btn btn-ghost" for="show-scroll">
Toggle scrollbar
</label>
</div>
<input type="checkbox" class="peer hidden" id="show-scroll" />
<div class="h-[20vh] peer-checked:h-[120vh] mt-2 bg-base-200 p-4">
Page content here
</div>
</div>
</div>
<div class="drawer-side max-h-screen">
<label for="drawer" aria-label="close sidebar" class="drawer-overlay"></label>
<ul class="menu bg-base-200 text-base-content min-h-full w-80 p-4">
<li>
<label class="btn btn-ghost" for="show-scroll">
Toggle page scrollbar
</label>
</li>
<li><a>Sidebar Item 1</a></li>
<li><a>Sidebar Item 2</a></li>
<li>
<label class="btn btn-ghost" for="hide-scroll-drawer">
Toggle drawer scrollbar
</label>
</li>
<input type="checkbox" class="peer hidden" id="hide-scroll-drawer" checked />
<div class="peer-checked:hidden">
<li><a>Sidebar Item 1</a></li>
<li><a>Sidebar Item 2</a></li>
<li><a>Sidebar Item 1</a></li>
<li><a>Sidebar Item 2</a></li>
<li><a>Sidebar Item 1</a></li>
<li><a>Sidebar Item 2</a></li>
<li><a>Sidebar Item 1</a></li>
<li><a>Sidebar Item 2</a></li>
<li><a>Sidebar Item 1</a></li>
<li><a>Sidebar Item 2</a></li>
<li><a>Sidebar Item 1</a></li>
<li><a>Sidebar Item 2</a></li>
<li><a>Sidebar Item 1</a></li>
<li><a>Sidebar Item 2</a></li>
<li><a>Sidebar Item 1</a></li>
<li><a>Sidebar Item 2</a></li>
<li><a>Sidebar Item 1</a></li>
<li><a>Sidebar Item 2</a></li>
<li><a>Sidebar Item 1</a></li>
<li><a>Sidebar Item 2</a></li>
<li><a>Sidebar Item 1</a></li>
<li><a>Sidebar Item 2</a></li>
<li><a>Sidebar Item 1</a></li>
<li><a>Sidebar Item 2</a></li>
<li><a>Sidebar Item 1</a></li>
<li><a>Sidebar Item 2</a></li>
<li><a>Sidebar Item 1</a></li>
<li><a>Sidebar Item 2</a></li>
<li><a>Sidebar Item 1</a></li>
<li><a>Sidebar Item 2</a></li>
<li><a>Sidebar Item 1</a></li>
<li><a>Sidebar Item 2</a></li>
<li><a>Sidebar Item 1</a></li>
<li><a>Sidebar Item 2</a></li>
<li><a>Sidebar Item 1</a></li>
<li><a>Sidebar Item 2</a></li>
<li><a>Sidebar Item 1</a></li>
<li><a>Sidebar Item 2</a></li>
<li><a>Sidebar Item 1</a></li>
<li><a>Sidebar Item 2</a></li>
<li><a>Sidebar Item 1</a></li>
<li><a>Sidebar Item 2</a></li>
<li><a>Sidebar Item 1</a></li>
<li><a>Sidebar Item 2</a></li>
</div>
</ul>
</div>
</div> |
saadeghi
reviewed
Oct 24, 2025
- rootscrolllock and rootscrollgutter (if included) apply settings based on flags set by the components as needed - modal always sets flags for overflow hidden, backdrop, ... - drawer checked sets flags for overflow hidden, backdrop, ... in its own layer - but drawer open reverts flags for overflow hidden, backdrop, ... in its own layer
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
@saadeghi
This move is good from the POV of css generation because now the styles are auto-generated in case variants are used for drawer-open.
This move is not good because now we have styles that concern rootscrolllock in drawer.The best would be if we could move these 2 blocks of code in rootscrolllock and declare them as variants as they are in drawer.Fixed the problem:
So rootscrollgutter and rootscrolllock are independent, can be included as desired, do not depend on tw prefix or daisy prefix, and do not depend on how(variant) the modal or drawer are used