Repository navigation
Conversation
Native lists close an open sliding item when the user presses anywhere else. While an item is open, listen for pointerdown on the document and close it when the press lands outside the item.
|
@toyeshhm is attempting to deploy a commit to the Ionic Team on Vercel. A member of the Team first needs to authorize it. |
This branch has not been deployed
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 #29504
What is the current behavior?
Once an
ion-item-slidingis opened, by swiping or by callingopen(), it stays open until the user swipes it closed, swipes a different sliding item, or the app callsclose()/closeSlidingItems(). Tapping anywhere else on the page leaves it open. On native iOS and Android, an open item closes as soon as the user presses anywhere outside of it.The only automatic close today is in
canStart, which closes the previously open item when another sliding item starts a gesture.What is the new behavior?
pointerdownon the document and closes when the press lands outside of the item. Presses on the item's own options do not close it, so option buttons still work.onStartandopen()) and removed when the item closes or is disconnected, so nothing listens while every item is closed.pointerdownhandler that stops propagation can't keep the item open, and it checkscomposedPath()so an item inside another component's Shadow DOM is still detected correctly. Both follow whation-picker-columnalready does for its outside press.item-sliding/test/basic: pressing outside closes an item opened withopen(), pressing outside closes a swiped open item, and pressing one of the item's options leaves it open. The two "pressing outside" tests fail onmainin all three browsers and pass with this change.Does this introduce a breaking change?
Other information
The press that closes the item is not swallowed. If the user taps another item while one is open, that item's click still fires after the open one closes. Native lists also swallow that tap; I left it out to keep this change to closing the item and not change how clicks reach other elements.
Ran locally: the
item-sliding,list,item-optionanditem-optionse2e suites (Mobile Chrome, Mobile Firefox, Mobile Safari), plus eslint and prettier on the changed files. I couldn't run the Docker screenshot setup, so screenshot tests ran against the local renderer. One of them, the Safari safe-area screenshot, failed once on a 382-pixel diff and then passed 12 out of 12 reruns. That test drags an item and takes a screenshot without pressing outside, so this change doesn't touch it.