Remove modals with duplicate id#2012
Merged
jonahtanjz merged 3 commits intoMarkBind:masterfrom Aug 18, 2022
Merged
Conversation
tlylt
reviewed
Aug 17, 2022
Contributor
There was a problem hiding this comment.
Thanks @jonahtanjz for the fix, since it also resolves the modal issue #1909 on our UG, perhaps we can link it in the PR description to close it as well.
I was thinking about this problem for a bit, and I wonder whether there are other cases of this problem due to how include is implemented, which may cause the id collision issue. For example, anchor scroll handling and scroll spy for pageNav. Will try to look into these in the coming weeks...
Contributor
|
@jonahtanjz Thanks for fixing this. Perhaps do a release, so that I can start using the bug fix in production sites? |
Contributor
Author
Just did a release :) |
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
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.
What is the purpose of this pull request?
Overview of changes:
Fixes #2008
Fixes #1909
The issue is caused by having modals of the same id on the same page (usually because the modals are included more than once using
<include>). Removing modals with ids that already exist fixes the issue. The issue with duplicated modals opening is also resolved.Anything you'd like to highlight/discuss:
Previous implementation allows for modals with the same id to be included/present on the page more than once. Having just 1 copy of the modal still allows the included
<trigger>s to open the modal. Not sure if I missed out on any edge cases where more than 1 modal of the same id needs to be on the page.Testing instructions:
<modal>s and<trigger>s with the same idProposed commit message: (wrap lines at 72 characters)
Remove modals with duplicate id
Modals with duplicate id on the same page will result in
triggers opening multiple modals and can cause the page
to be unscrollable after the modal is closed.
Let's remove modals with duplicate id so that only one
copy of the modal for each id will exist on the page.
Checklist: ☑️