Skip to content
This repository has been archived by the owner on Aug 29, 2023. It is now read-only.

select: label style/position is wrong on iOS after other md-select selection occurs #11345

Closed
rantiev opened this issue Jun 27, 2018 · 7 comments · Fixed by #11739 or GulajavaMinistudio/material#138
Assignees
Labels
for: internal contributor The team will address this issue and community PRs are not requested. has: Pull Request A PR has been created to address this issue os: iOS This issue is specific to iOS P3: important Important issues that really should be fixed when possible. resolution: fixed type: bug
Milestone

Comments

@rantiev
Copy link

rantiev commented Jun 27, 2018

Type:

Bug

CodePen and steps to reproduce the issue:

CodePen Demo which demonstrates the issue:

http://output.jsbin.com/sabobu

Detailed Reproduction Steps:

  1. Tap to first input, don't select any options
  2. Tap to next

What is the expected behavior?

Color and position of label reverted to initial state

What is the current behavior?

The first is still focused: lable position not updated, color not reverted to gray

What is the use-case or motivation for changing an existing behavior?

Which versions of AngularJS, Material, OS, and browsers are affected?

  • AngularJS: 1.6.8
  • AngularJS Material: 1.1.9
  • OS: iOs
  • Browsers: Mobile safari

Is there anything else we should know? Stack Traces, Screenshots, etc.

@rantiev rantiev changed the title md-select has wrong behavior in iPad/iPhone safari md-select label style/position is wrong in iPad/iPhone safari after other md-select selection Jun 27, 2018
@Splaktar Splaktar changed the title md-select label style/position is wrong in iPad/iPhone safari after other md-select selection select: label style/position is wrong on iOS after other md-select selection occurs Jul 4, 2018
@Splaktar Splaktar added the os: iOS This issue is specific to iOS label Jul 4, 2018
@Splaktar
Copy link
Member

Splaktar commented Jul 4, 2018

I am able to reproduce this on iOS 11.4. It seems like the blur events aren't being handled properly.

It looks like the newer versions of iOS introduce some non-standard way of interacting with select elements:
simulator screen shot - iphone x - 2018-07-04 at 16 26 52
This can be seen with the following CodePen.

I don't have the ability to run older versions of iOS to determine when this behavior was changed.

I migrated this jsbin to CodePen so that I could change it.

@Splaktar Splaktar added for: external contributor needs: investigation The cause of this issue is not well understood and needs to be investigated by the team or community labels Jul 4, 2018
@Splaktar Splaktar added this to the - Backlog milestone Jul 4, 2018
@Splaktar
Copy link
Member

Splaktar commented Jul 4, 2018

It looks like that new select UI is on the iPhone X, but not the iPhone 5s:
simulator screen shot - iphone 5s - 2018-07-04 at 16 43 48

This issue does not occur on macOS Safari (11.1.1 (13605.2.8)).

@Splaktar
Copy link
Member

Splaktar commented Jul 4, 2018

It looks like the class="md-input-focused" isn't being removed from the md-input-container when the blur event is fired.

The logic related to this can be found here:

if (!isReadonly) {
element
.on('focus', function(ev) {
// Always focus the container (if we have one) so floating labels and other styles are
// applied properly
containerCtrl && containerCtrl.setFocused(true);
});
// Attach before ngModel's blur listener to stop propagation of blur event
// to prevent from setting $touched.
element.on('blur', function(event) {
if (untouched) {
untouched = false;
if (selectScope._mdSelectIsOpen) {
event.stopImmediatePropagation();
}
}
if (selectScope._mdSelectIsOpen) return;
containerCtrl && containerCtrl.setFocused(false);
inputCheckValue();
});
}

It's unclear to me what these comments about $touched mean or why these extra checks are here for select as compared to input:

if (!isReadonly) {
element
.on('focus', function(ev) {
$mdUtil.nextTick(function() {
containerCtrl.setFocused(true);
});
})
.on('blur', function(ev) {
$mdUtil.nextTick(function() {
containerCtrl.setFocused(false);
inputCheckValue();
});
});
}

@Splaktar Splaktar added type: bug needs: Pull Request and removed needs: investigation The cause of this issue is not well understood and needs to be investigated by the team or community labels Jul 4, 2018
@Splaktar Splaktar modified the milestones: - Backlog, 1.1.11 Jul 4, 2018
@pavelsl
Copy link

pavelsl commented Jul 20, 2018

Wow, i'm very impressed seeing one had reproduced issue i'm talking about. God bless you. I thought you are not exist. Hope in the new version we see less issues not more and this one.

Looking to https://material.angularjs.org/latest/demo/select on my iPad mini iOs 11 i can say that dropdown position never updated after scrolling. Not sure whether you want it like this.

@Splaktar Splaktar added the P4: minor Minor issues. May not be fixed without community contributions. label Jul 21, 2018
@Splaktar Splaktar modified the milestones: 1.1.11, 1.1.12 Sep 10, 2018
@Splaktar Splaktar modified the milestones: 1.1.12, 1.1.13 Jan 3, 2019
@pavelsl
Copy link

pavelsl commented Jan 28, 2019

Let's just migrate to new angular and improve new material lib (it's doc and components issues) instead )

@Splaktar
Copy link
Member

I tested with $mdGestureProvider.skipClickHijack(); but it did not help with this case.

This appears to be related to clicking on the md-scroll-mask not sending a blur event to the select element on iOS only as mentioned in #9581 (comment).

@Splaktar Splaktar added P3: important Important issues that really should be fixed when possible. and removed P4: minor Minor issues. May not be fixed without community contributions. labels Feb 2, 2019
@Splaktar Splaktar modified the milestones: 1.1.13, 1.1.14 Feb 10, 2019
@Splaktar Splaktar modified the milestones: 1.1.14, g3: sync Feb 15, 2019
@Splaktar Splaktar self-assigned this May 10, 2019
@Splaktar Splaktar added the for: internal contributor The team will address this issue and community PRs are not requested. label May 10, 2019
Splaktar added a commit that referenced this issue Jun 6, 2019
also fix focus jumping back to md-select after tapping another input

Fixes #11345
@Splaktar Splaktar added has: Pull Request A PR has been created to address this issue and removed for: external contributor labels Jun 6, 2019
@Splaktar Splaktar modified the milestones: g3: sync, 1.1.20 Jun 6, 2019
@Splaktar
Copy link
Member

Splaktar commented Jun 6, 2019

I've posted PR #11739 to solve this.

mmalerba pushed a commit that referenced this issue Aug 12, 2019
also fix focus jumping back to md-select after tapping another input

Fixes #11345
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
for: internal contributor The team will address this issue and community PRs are not requested. has: Pull Request A PR has been created to address this issue os: iOS This issue is specific to iOS P3: important Important issues that really should be fixed when possible. resolution: fixed type: bug
Projects
None yet
3 participants