Skip to content
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

fix(action-sheet): fix action sheet so it will scroll when the options exceed the screen #13049

Merged
merged 9 commits into from
Oct 6, 2017

Conversation

brandyscarney
Copy link
Member

@brandyscarney brandyscarney commented Oct 4, 2017

Short description of what this resolves:

Action Sheet will now scroll when the options exceed the screen height, before it would just go off the screen and you couldn't get to them.

Changes proposed in this pull request:

  • Adds ability to scroll action sheet buttons for ios, md, and wp mode when they exceed the screen height
  • Removes the warning from select when using "action-sheet" interface with more than 6 options, this is now supported since it will scroll the options

Ionic Version: 1.x / 2.x / 3.x
3.x

Fixes: #12735

Nightly for testing: [email protected]

Before:

screen shot 2017-10-04 at 5 14 26 pm

After:

screen shot 2017-10-04 at 5 15 31 pm

Note: need to check the action sheet with the status bar on a device

Gif of all modes:

Gif on an ios simulator:

gif-for-brandy 1

@@ -103,13 +106,25 @@ $action-sheet-ios-button-cancel-font-weight: 600 !default;
@include border-radius($action-sheet-ios-border-radius);
@include margin(null, null, $action-sheet-ios-group-margin-bottom - 2, null);

overflow: hidden;
overflow: scroll;
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we add overflow-y only? So borders do not show on overflow

Copy link
Contributor

Choose a reason for hiding this comment

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

  • Maybe move this rule to the common action-sheet.scss file?

.action-sheet-ios .action-sheet-group:first-child {
@include margin($action-sheet-ios-group-margin-top, null, null, null);

flex-shrink: 2;
Copy link
Contributor

Choose a reason for hiding this comment

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

I think flex-shrink: 1 is enough (or maybe no)


overflow: hidden;

flex-shrink: 0;
Copy link
Contributor

Choose a reason for hiding this comment

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

another way to prevent this node to shrink is to use min-height with the correct value (just one idea, not a big deal).

}

.action-sheet-md .action-sheet-group:last-child {
@include padding(0, 0, .8rem, 0);
Copy link
Contributor

Choose a reason for hiding this comment

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

we need also need here: flex-shrink: 0

}

.action-sheet-md .action-sheet-group:first-child {
@include padding(.8rem, 0, 0, 0);
Copy link
Contributor

@manucorporat manucorporat Oct 4, 2017

Choose a reason for hiding this comment

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

add here:

 flex-shrink: 2;

MAYBE! we can move this flex-shrink to common css file, so we don't have to duplicate it across all the modes

Copy link
Contributor

Choose a reason for hiding this comment

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

  • Maybe make the .8rem a variable -
$action-sheet-first-group-padding-top: .8rem;
$action-sheet-last-group-padding-bottom: $action-sheet-first-group-padding-top;

$action-sheet-md-first-group-padding-top: $action-sheet-first-group-padding-top;
$action-sheet-md-last-group-padding-bottom: $action-sheet-last-group-padding-bottom;

$action-sheet-wp-first-group-padding-top: $action-sheet-first-group-padding-top;
$action-sheet-wp-last-group-padding-bottom: $action-sheet-last-group-padding-bottom;
  • It doesn't seem like there is a need to pad it with 0, a group does not have padding anyway. (use null)


background: $action-sheet-wp-background;
}

.action-sheet-wp .action-sheet-group:first-child {
@include padding(.8rem, 0, 0, 0);
Copy link
Contributor

Choose a reason for hiding this comment

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

same here:

 flex-shrink: 2;

}

.action-sheet-wp .action-sheet-group:last-child {
@include padding(0, 0, .8rem, 0);
Copy link
Contributor

Choose a reason for hiding this comment

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

 flex-shrink: 0;

also adds variables for md and wp mode padding and removes unused
$action-sheet-md-group-margin-bottom var
@brandyscarney
Copy link
Member Author

Thanks for reviewing @manucorporat and @AmitMY! I just pushed a commit to fix the following:

  • flex shrink on all modes to prevent cancel button from collapsing on smaller screens
  • webkit-mask-image to prevent border going outside of the border radius on iOS devices
  • adds variables for md/wp for padding & removes the 0's so it only sets padding-top/bottom
  • removes $action-sheet-md-group-margin-bottom since it wasn't being used

@manucorporat manucorporat merged commit 199cb00 into master Oct 6, 2017
@youssmak
Copy link

love it 😍 , thank u !

@brandyscarney brandyscarney deleted the action-sheet-scroll branch December 1, 2017 17:49
@keithdmoore
Copy link
Contributor

Great work! I'm glad that we can have more than 6 entries! Is there any way to address the "janky-ness" of the scroll now?

@brandyscarney
Copy link
Member Author

@keithdmoore Do you mean the lack of inertia scrolling or is there something else going on?

@keithdmoore
Copy link
Contributor

keithdmoore commented Dec 7, 2017

@brandyscarney I suppose that is what is missing. It just fills really janky. I wanted to allow a user to select a state from a list of all 50 states. When I tried that, it just felt way too janky. I suppose I should create a separate page with a scrollable list and maybe a search bar. Maybe I was just trying to use the action sheet for something it's really not intended to be used for.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants