fix(popover): viewport can be scrolled if no content present - #29215
Merged
Conversation
liamdebeasi
commented
Mar 25, 2024
| * we should fallback to the old behavior for environments that do not support :has. | ||
| * Developers can explicitly enable this behavior by setting overflow: visible | ||
| * on .popover-viewport if they know they are not going to use an ion-content. | ||
| * TODO FW-XXXX Remove this |
Contributor
Author
There was a problem hiding this comment.
If the team is on board with this approach, I'll make a tech debt ticket and populate the ticket number here.
Contributor
There was a problem hiding this comment.
Also good with this approach 👍
liamdebeasi
marked this pull request as ready for review
March 25, 2024 17:24
Contributor
|
As for tests, could we do one of the following:
|
Contributor
Author
|
Good idea! I added a similar test to the PR. |
averyrousseau
approved these changes
Apr 1, 2024
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.
Issue number: resolves #29211
What is the current behavior?
In #28861 I fixed a bug that caused
.popover-viewportto haveoverflow: hidden. In reality, this code should have always applied but due to an incorrect selector it never did.As it turns out in #29211, some developers were relying on the broken behavior to build their applications. In particular, developers were using
ion-popoverwithout anion-content. The linked change made it so that using popovers withoution-contentwere not scrollable.After talking with @mapsandapps we think it makes sense to officially support this behavior. We support using modals without
ion-content, and we could not think of a reason to not support the same use case for popover.What is the new behavior?
.popover-viewportelement has a child content then.popover-viewportwill not be scrollable..popover-viewportelement does not have a child content then.popover-viewportwill be scrollable.I implemented this behavior using progressive enhancement via
:has. The:haspseudo-class has cross-browser support. Ionic v7 supports some versions of browsers that do not have:hassupport. As a result, we fall back to the existing behavior in this environment. Developers are able to get this behavior on older browsers by explicitly settingoverflow: autoon.popover-viewport.Fortunately, we will be dropping support for several of the older browsers versions in Ionic v8, so the need to do the manual opt-in should be less frequent as time goes on.
Does this introduce a breaking change?
Other information
Dev build:
7.8.2-dev.11711383079.118d48a5Testing:
I could not find a great way to automate this test, but let me know if anyone has ideas!