Fix scrolling of longer-than-viewport bootstrap modal in a <dialog> #3447
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.
Blacklight uses Bootstrap modal css (I'm not sure about the JS), but uses an HTML5
<dialog>
element for the modal, which bootstrap isnt' really expecting.Specifically, it looks like the
<dialog>
with the classmodal
serves as a sort of full-screen 'wrapper'.Before this PR, scrolling a higher-than-viewport modal would have this odd behavior:
Screen.Recording.2024-11-21.at.2.56.58.PM.mov
Note how the modal disappears under some kind of "invisible" blockers at top and bottom. This is an unnatural and undesirable effect.
Also notice how the scrollbar is floating som distance from the right edge?
This is caused because at least in Chrome, there's a default user-agent stylesheet on
dialog
that sets:Presumably becuase it expects the dialog will be an actual
dialog
not a wrapper/overlay?Unsetting these makes the scroll seem closer to normal again.
Screen.Recording.2024-11-20.at.4.53.27.PM.mov
There are a couple more oddities, one of which you can see at the end of there.
<dialog>
. (I wonder if this is an accessibilty issue?)I wonder if we want to revisit the choice to try to marry a bootstrap dialog to an
html5
dialog? But in the meantime, I think this helps?