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

bug: Remove margin from select popover. #23971

Closed
4 of 6 tasks
infacto opened this issue Sep 23, 2021 · 3 comments · Fixed by #23972
Closed
4 of 6 tasks

bug: Remove margin from select popover. #23971

infacto opened this issue Sep 23, 2021 · 3 comments · Fixed by #23972
Labels
package: core @ionic/core package type: bug a confirmed bug report
Milestone

Comments

@infacto
Copy link

infacto commented Sep 23, 2021

Prequisites

Ionic Framework Version

  • v4.x
  • v5.x
  • v6.x

Current Behavior

The popover always scrolls a pixel which looks weird and untidy.

demo 👎

image

Why is margin-top and margin-bottom set to -1px?

Related source code.

Expected Behavior

Don't scroll. Set margin to 0 and in this example padding is also 0. But margin 0 will fix this issue.

demo 👍

Steps to Reproduce

<ion-list class="ion-no-padding">
  <ion-item-group>
    <ion-item>
      <ion-label>Select Option</ion-label>
      <ion-select placeholder="Please select." interface="popover">
        <ion-select-option> A </ion-select-option>
        <ion-select-option> B </ion-select-option>
        <ion-select-option> C </ion-select-option>
      </ion-select>
    </ion-item>
  </ion-item-group>
</ion-list>

Play with that. Then add following css to the global.scss.

.sc-ion-select-popover {
  padding: 0 !important;
  margin: 0 !important;
}

Enjoy.

Personally I prever ion-no-padding for lists. We could set this by default for the list. Just consider it for the select popover interface. But the primary issue is to fix the unnecessary scroll behavior (margin).

Ionic Info

Ionic:

   Ionic CLI                     : 6.16.1
   Ionic Framework               : @ionic/angular 5.8.1
   @angular-devkit/build-angular : 12.1.4
   @angular-devkit/schematics    : 12.1.4
   @angular/cli                  : 12.1.4
   @ionic/angular-toolkit        : 4.0.0

System:

   NodeJS : v14.15.1
   npm    : 6.14.8
   OS     : Windows 10
@ionitron-bot ionitron-bot bot added the triage label Sep 23, 2021
@liamdebeasi
Copy link
Contributor

liamdebeasi commented Sep 23, 2021

Thanks, I can reproduce this. Looks like these -1px margins go all the way back to Ionic v3: https://github.com/ionic-team/ionic-v3/blob/master/src/components/select/select.scss#L7-L15.

The original context is no longer there as I cannot find an associated PR or GitHub issue. My current guess is this was added to work around some old Chromium/WebKit/UIWebView bug.

I will look into removing it.

edit: One side effect is that the -1px margins add the rubber band effect on non-scrollable content on iOS. That being said, I am not sure non-scrollable popovers should rubber band. I need to investigate this a bit more to what native does.

edit 2: Confirmed by testing a native popover on iOS that non-scrollable popovers should not rubber band.

@liamdebeasi
Copy link
Contributor

Thanks for the issue. This has been resolved via #23972 and a fix will be available in an upcoming release of Ionic Framework.

@liamdebeasi liamdebeasi added this to the 5.8.2 milestone Sep 27, 2021
@ionitron-bot
Copy link

ionitron-bot bot commented Oct 27, 2021

Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.

@ionitron-bot ionitron-bot bot locked and limited conversation to collaborators Oct 27, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
package: core @ionic/core package type: bug a confirmed bug report
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants