Skip to content

feat(modal): clicking handle advances to the next breakpoint #25057

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

Closed
wants to merge 12 commits into from

Conversation

sean-perkins
Copy link
Contributor

@sean-perkins sean-perkins commented Apr 4, 2022

Pull request checklist

Please check if your PR fulfills the following requirements:

  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been reviewed and added / updated if needed (for bug fixes / features)
  • Build (npm run build) was run locally and any changes were pushed
  • Lint (npm run lint) has passed locally and any fixes were made for failures

Pull request type

Please check the type of change your PR introduces:

  • Bugfix
  • Feature
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • Documentation content changes
  • Other (please describe):

What is the current behavior?

When clicking the handle inside a sheet modal, it does not advance to the next breakpoint.

Issue URL: #24069

What is the new behavior?

Clicking the handle will advance to the next breakpoint. If the user is at the last breakpoint, the sheet will advance to the first non-zero breakpoint.

While native iOS does have the ability to double tap the handle to dismiss the sheet modal (in certain experiences), we are not replicating that behavior in this feature. I believe that UX could be confusing and disruptive to users.

Does this introduce a breaking change?

  • Yes
  • No

Other information

@sean-perkins sean-perkins requested a review from a team April 4, 2022 18:49
@github-actions github-actions bot added the package: core @ionic/core package label Apr 4, 2022
@@ -689,6 +689,21 @@ export class Modal implements ComponentInterface, OverlayInterface {
return this.currentBreakpoint;
}

private onHandleClick = () => {
const { breakpoints, currentBreakpoint } = this;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tabbing to the handle and pressing Enter multiple times causes the animation to jump.

Screen.Recording.2022-04-04.at.6.24.48.PM.mov

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adjusted this behavior slightly, so that advancing is tied to keyup instead of keydown. Setting the current breakpoint does not currently wait for the previous transition to finish. If you perform an action while a transition is inflight, it will disrupt the transition.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like it's still jumping if you mash Enter; I feel like if there's a transition in progress when you click/activate the handle, it should just do nothing.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@amandaesmith3 to confirm, if the user performs any action (clicking the handle or pressing enter), while the sheet modal is actively transitioning, the expected behavior would be to perform no operation (skip the interaction)?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking back at the code, present and dismiss will both wait for the current transition and then go through with the attempted interaction, so we should probably go with that instead here. Thinking on it, if I hit Enter twice quickly, having it only move to the next breakpoint once would feel off. 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Waiting for the transition feels like it would conflict with the design document for the API of moving to a breakpoint:

If the user is in the middle of a gesture when this API is called, the user will be transitioned to the breakpoint value called by the API.

Unless we can cancel the current transition and immediately kick-off the new transition without a glitchy experience. I can do some more discovery on this.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated the behavior, curious to both of your thoughts/feedback/alternatives. It now won't skip/jitter when you hold the enter key, but it will only performs moving to the next breakpoint when the current animation finishes. Hard to demonstrate in a recording.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So when I try it, pressing Enter twice rapidly makes it only move once. It seems like it'll just eat your input if the animation is currently running. My guess is that since the current breakpoint doesn't actually update until after the animation finishes (triggered here), nextBreakpoint is calculated as the same thing for both Enter presses. Which would make the second press not really do anything.

That said, I'm okay with the behavior as-is. Up to you if you want to change it, though if we stick with it as-is, the code should probably be cleaned up to make it more clear.

@EinfachHans
Copy link
Contributor

Nice you tackled this 😊 Maybe it would be good to add a property to be able to disable this behaviour? There are apps that have this and others that don't have this…

@sean-perkins
Copy link
Contributor Author

Nice you tackled this 😊 Maybe it would be good to add a property to be able to disable this behaviour? There are apps that have this and others that don't have this…

@EinfachHans oddly enough just had this exact conversation with the team 😆 we are going to hold on this PR until after 6.1.0 to write up a feature design document that covers the API additions and user behavior. Originally we anticipated this as a bug fix, but after comparing against other app patterns, we noticed that:

  1. Showing/hiding the handle is configurable in Swift/iOS
  2. Some apps support clicking the handle, others do not

While this is a nice user enhancement, we want to make sure we get it right and offer the best configurations for developers to make use of it for their apps.

@Abuturab1234
Copy link

Looking back at the code, present and dismiss will both wait for the[ current transition](text ) and then go through with the attempted interaction, so we should probably go with that instead here. Thinking on it, if I hit Enter twice quickly, having it only move to the next breakpoint once would feel off.

@sean-perkins
Copy link
Contributor Author

Closing in favor of: #25540

@sean-perkins sean-perkins deleted the FW-262 branch March 24, 2023 18:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
package: core @ionic/core package
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants