Skip to content
This repository was archived by the owner on Sep 5, 2024. It is now read-only.

select: can have 2 options with a selected (grey) background #9851

Closed
lpatingre opened this issue Oct 18, 2016 · 6 comments · Fixed by #12015
Closed

select: can have 2 options with a selected (grey) background #9851

lpatingre opened this issue Oct 18, 2016 · 6 comments · Fixed by #12015
Assignees
Labels
has: Pull Request A PR has been created to address this issue P3: important Important issues that really should be fixed when possible. resolution: fixed ui: CSS ui: focus ux: polish
Milestone

Comments

@lpatingre
Copy link

Hi,

With Angular Materials 1.1, it seems that both the md-option with the focus and the one with mouse-over have a grey background. You can view that on the demos page:
https://material.angularjs.org/latest/demo/select

So clicking on a select you can move one of the grey background elements with the keyboard arrows and the other by hovering the mouse, leading to 2 different elements having a grey background (both can differ from the currently selected option which has a blue text color).

I couldn't find it reported and it felt a bit confusing to me.
So I just wanted to confirm if it was intended behavior (trying to please both people navigating with the mouse and people navigating with the keyboard) or something you intended to modify in a future release.

Thanks.

@ThomasBurleson
Copy link
Contributor

@clshortfuse - Would you respond to @lpatingre here? THx.

@clshortfuse
Copy link
Contributor

clshortfuse commented Oct 18, 2016

@lpatingre I took a look at your issue and, yes, two background colors is an issue.

It appears as though this actually stems from usage of both focus and hover styles of popup items. After using different Google sites as reference (namely Google Drive), it seems it would be better that popup items do not have focus and instead, be managed by the controller. The background color should based on navigation, and said navigation should move when a user hovers on an element.

mdMenu appears to move navigation on hover, as I stated, but it seems as though it too can style two items at the same time.

@clshortfuse
Copy link
Contributor

The current plan is to create a new shared implementation between select, menu, and autocomplete in terms of vertical list navigation for Angular Material 2. Angular Material 1 will use a backport of the completed feature.

@lpatingre
Copy link
Author

Sounds good. Thanks for the update.

@Splaktar Splaktar changed the title md-select can have 2 md-options with a grey background select: can have 2 options with a selected (grey) background Sep 8, 2019
@Splaktar Splaktar added ux: polish needs: investigation The cause of this issue is not well understood and needs to be investigated by the team or community P3: important Important issues that really should be fixed when possible. labels Sep 8, 2019
@Splaktar
Copy link
Member

Splaktar commented Sep 8, 2019

This is still reproducible. Unfortunately, the spec for menus provides no guidance on how to handle this.

There is currently no plan to backport a "shared implementation" of focus from Angular Material. However, it should be noted that this same behavior exists there today: https://material.angular.io/components/select/overview.

Note that MDC Web's Select uses a different grey for

  • hover
.mdc-list-item:hover::before {
    opacity: .04;
}
  • focus
.mdc-list-item:focus::before {
    opacity: .12;
}

This may be feasible to do in AngularJS Material.

@Splaktar Splaktar removed the needs: investigation The cause of this issue is not well understood and needs to be investigated by the team or community label Sep 8, 2019
@clshortfuse
Copy link
Contributor

FYI, my current solution is to trigger focus on the mousemove event.

https://github.com/clshortfuse/materialdesignweb/blob/ed1910af16c5a6d1c2377532fb5fe9dce7f758fe/components/menu/item.js#L121

This replicates how desktops operating systems handle mouse interaction. That results in keyboard and mouse always being synchronized.

Even if the focus operation isn't explicitly used case, it makes sense for the keyboard to continue off from the last item the mouse hovered over.

@Splaktar Splaktar modified the milestones: - Backlog, 1.2.1 Sep 21, 2020
@Splaktar Splaktar self-assigned this Sep 21, 2020
@Splaktar Splaktar added the has: Pull Request A PR has been created to address this issue label Sep 21, 2020
Splaktar added a commit that referenced this issue Sep 21, 2020
- use a similar approach to the one used by MDC
  - the opacity values are slightly different because
    they use `#000` and we use `rgba(0, 0, 0, 0.87)`

Fixes #9851
Splaktar added a commit that referenced this issue Sep 21, 2020
- use a similar approach to the one used by MDC
  - the opacity values are slightly different because
    they use `#000` and we use `rgba(0, 0, 0, 0.87)`

Fixes #9851
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
has: Pull Request A PR has been created to address this issue P3: important Important issues that really should be fixed when possible. resolution: fixed ui: CSS ui: focus ux: polish
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants