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

Setting selection mode to disabled does not disable selection #401

Closed
doctor-g opened this issue Jul 7, 2016 · 4 comments
Closed

Setting selection mode to disabled does not disable selection #401

doctor-g opened this issue Jul 7, 2016 · 4 comments
Assignees

Comments

@doctor-g
Copy link

doctor-g commented Jul 7, 2016

The 'disabled' selection mode does not disable selection with the mouse. I have set the selection mode using selection-mode="disabled" in the HTML and via grid.selection.mode="disabled" in JavaScript. Mousing over rows highlights them, and clicking them selects them. I expected this to be turned off while selection-mode is disabled.

Using vaadin-grid 1.1.0.

I have not verified the behavior on touch devices.

@tomivirkki
Copy link
Member

Hi @doctor-g,

The vaadin-grid rows have by default 3 different visual state indicators

  • hovered row (dark gray background)
  • focused row (primary color underline)
  • selected row (light gray background)

Disabling row selection doesn't turn off row hover and focus but only the selection functionality. My guess is that in your case the row didn't actually get selected, but focused.

Just verified it's working as it should at https://cdn.vaadin.com/vaadin-elements/latest/vaadin-grid/demo/selection.html (grid.selection.selected() always returns an empty array when selection is disabled)

@doctor-g
Copy link
Author

doctor-g commented Jul 8, 2016

What you describe is sensible, although your intention and the user experience are quite different. It sure looks like I'm selecting a row when I click on it to give it focus---and it's that UX that I want to modify. Are there styles to disable the coloration on hover and focus?

@tomivirkki
Copy link
Member

There's a mixin in vaadin-grid (--vaadin-grid-selected-row-cell) that applies to selected row cells and can thus be used to affect the appearance of selections.

For removing the focus indicator, best option currently is to set the --primary-color to transparent for the vaadin-grid.

Hover style is fixed so need to use /deep/ selector there for now to modify it.

FYI: While examining the issue today, I bumped into a (vaadin-grid 1.1.0) regression with the row focus feature. As it doesn't function properly at the moment it's very understandable that it can be confused with row selection. To see how the focus row is supposed to be working (keyboard selection), see the demos of vaadin-grid 1.0.0.

@doctor-g
Copy link
Author

doctor-g commented Jul 8, 2016

Thank you for your help!

@manolo manolo self-assigned this Jul 12, 2016
@Saulis Saulis closed this as completed Jul 29, 2016
HJK181 pushed a commit to CommerceExperts/vaadin-grid that referenced this issue Jul 27, 2020
HJK181 pushed a commit to CommerceExperts/vaadin-grid that referenced this issue Jul 27, 2020
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

No branches or pull requests

4 participants