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

feat(list-box): update selection style #4753

Merged
merged 8 commits into from
Jan 15, 2020

Conversation

asudoh
Copy link
Contributor

@asudoh asudoh commented Nov 22, 2019

Fixes #3988.
Refs #4376.

Changelog

New

  • New selection style for list box item.

Testing / Reviewing

Testing should make sure combo box and dropdown are not broken.

@netlify
Copy link

netlify bot commented Nov 22, 2019

Deploy preview for the-carbon-components ready!

Built with commit 091be2f

https://deploy-preview-4753--the-carbon-components.netlify.com

@netlify
Copy link

netlify bot commented Nov 22, 2019

Deploy preview for carbon-elements ready!

Built with commit 091be2f

https://deploy-preview-4753--carbon-elements.netlify.com

@netlify
Copy link

netlify bot commented Nov 22, 2019

Deploy preview for carbon-components-react ready!

Built with commit 091be2f

https://deploy-preview-4753--carbon-components-react.netlify.com

Copy link
Member

@laurenmrice laurenmrice left a comment

Choose a reason for hiding this comment

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

  • Make sure we are using the 16px icon for chevron and the checkmark.

  • Hover and selected states look like the same color. Should be using hover-ui for hover and selected-ui for selected
    Screen Shot 2019-11-22 at 9 31 43 AM

  • Inline listbox in vanilla and inline dropdown in react: The checkmark icon should be vertically aligned with the chevron icon. Right now it’s too far left.
    Screen Shot 2019-11-22 at 9 32 41 AM

  • The checkmark icon looks like the wrong color in the dark themes. It should be calling icon-01

  • Combobox is getting a secondary invalid border when it is set to invalid and disabled.
    Screen Shot 2019-11-22 at 9 37 49 AM

  • When we have overflow content inside an item that is selected, we need to still keep enough padding on the right hand side to allow space between the ellipses and to keep the checkmark aligned vertically with the chevron. Right now the checkmark icon is overlapping the ellipses.
    Needs to look like this:
    Screen Shot 2019-11-22 at 9 49 04 AM

@joshblack
Copy link
Contributor

Hey @asudoh! 👋 This looks like an enhancement PR, I think as a group we're tackling fixes through end of year (in particular accessibility) Would be great to focus our attention on those and reserve these types of PR for the new year 👍

@asudoh
Copy link
Contributor Author

asudoh commented Nov 23, 2019

Seems that the referring issue (#3988) is an attempt to address the color contrast issue with selected dropdown item. @laurenmrice Any thoughts on the highlights? Thanks!

P.S. for @laurenmrice will take a look the comments next week.

@asudoh
Copy link
Contributor Author

asudoh commented Nov 25, 2019

Thanks again @laurenmrice for reviewing!

  • Yes, 16 pixels version of checkmark icon is in use
  • I can see that the hover highlight is using $hover-ui and the selected item is using $selected-ui. Probably the difference was not observed because they are close (#e5e5e5 for $hover-ui, #e0e0e0 for $selected-ui)
  • Fixed the selected icon position in the inline variant
  • Fixed the checkmark icon color
  • Fixed the right margin of the long (selected) menu item
  • Fixed the invalid outline for disabled/invalid combination

Copy link
Member

@laurenmrice laurenmrice left a comment

Choose a reason for hiding this comment

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

-There is still something odd going on with the hover and selected states. Here is an example of when something is already is selected it gets a lighter hover change if you move the cursor on that selected item. Then when you hover to an item that is not selected it still gets the same color as the selected item.
Nov-26-2019 13-00-39


-For long strings of text with ellipses, can we have 16px padding on the left and right before and after the checkmark, and when there is no checkmark present have 48px? Right now the elipses going full line and then changing to shorten even more when selected with the checkmark gets jumpy.

Spec:
Screen Shot 2019-11-26 at 1 11 19 PM

@asudoh
Copy link
Contributor Author

asudoh commented Nov 27, 2019

Thanks @laurenmrice for another round of review! Fixed the right margin and the background color of the selected item.

@joshblack
Copy link
Contributor

@laurenmrice how should this behave if scrollbars are enabled? Was running into:

image

Copy link
Contributor

@joshblack joshblack left a comment

Choose a reason for hiding this comment

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

Looks great! Just had the one question with scroll bars

Copy link
Member

@laurenmrice laurenmrice left a comment

Choose a reason for hiding this comment

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

Vanilla and React

  • The rules separating the items in the dropdown is getting cutoff on the right. they should be the same distance away as they are on the left.

To joshs comment: Checkmark should still stay vertically aligned with chevron if there is a scrollbar. would rather always have them in place instead of them jumping around.

@joshblack
Copy link
Contributor

@laurenmrice I'm not sure if that is do-able in CSS as we don't know if a fixed scrollbar is being displayed, or not since it's an OS-level setting. I think we also will run into this with Windows/Edge, and the scrollbars themselves may have variable width (e.g. 15 vs 16px for macOS vs Windows)

@laurenmrice
Copy link
Member

laurenmrice commented Dec 16, 2019

@joshblack sorry for delayed response, have been consumed by patterns project. just curious, do you know how often people keep scrollbars persistant? just trying to guage how often this kind of scenario would occur

@joshblack
Copy link
Contributor

@laurenmrice it tends to come up for Windows/Linux users and for folks who have a mouse connected to their Mac through a USB (not a trackpad). I personally fall under that last situation, for example, since I always use a mouse when at work/at home.

@joshblack
Copy link
Contributor

bump @laurenmrice if you have a sec!

@laurenmrice
Copy link
Member

laurenmrice commented Jan 7, 2020

@joshblack oh ! sorry for delayed response on this. im going to discuss this with design tomorrow to get a consensus. 👍🏻

@laurenmrice
Copy link
Member

@joshblack https://opensource.adobe.com/spectrum-css/components/dropdown/ adobe is treating the select state of a dropdown similarly to what we are trying to accomplish. Could you test to see how their checkmark adjusts with a persistent scrollbar in the scenarios you are talking about? (i don't use a mouse or have one with a usb)

@joshblack
Copy link
Contributor

@laurenmrice for sure!

image

So for people on Windows/Linux and for those on Mac with a mouse wheel they'll end up seeing this version when it overflows 😞

@laurenmrice
Copy link
Member

Thanks Josh for trying that out ! I would like to see if @asudoh could tryout some ways to see if it is possible to keep the checkmark inline with the chevron even if scrollbars are enabled. If he ends up finding its def not possible to keep them aligned in that scenario, then we can go this route.

@asudoh
Copy link
Contributor Author

asudoh commented Jan 11, 2020

@laurenmrice Thank you for clarifying the goal you had in mind. I used to work on a logic of detecting if there is a scroll bar or not, and found out that it's error-prone and has performance problems.

Copy link
Member

@laurenmrice laurenmrice left a comment

Choose a reason for hiding this comment

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

Ok if thats the case from that issue that trying to align things with enabled scrollbars is finicking and my not be a consistent experience then we can just leave it.

A couple more changes though:

  • The rules separating the items needs to be 16px away from the right hand side. Right now they are too short.

Screen Shot 2020-01-13 at 10 42 38 AM

@asudoh
Copy link
Contributor Author

asudoh commented Jan 15, 2020

Thank you for your review @laurenmrice! Fixed dropdown item border. Wrt checkmark icon, confirmed that checkmark/16 is used.

Copy link
Member

@laurenmrice laurenmrice left a comment

Choose a reason for hiding this comment

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

So everything regarding the new selection state looks good for listbox, dropdown, combobox in vanilla and react. (However I see lots of bugs with these components in other aspects in Vanilla. I can make separate issues for those.)

@asudoh
Copy link
Contributor Author

asudoh commented Jan 15, 2020

Cool thanks @laurenmrice for reviewing! Don't hesitate to file other bugs you found!

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

Successfully merging this pull request may close these issues.

Design Needed to signify 'selected' item (current value) in List Box and other controls.
4 participants