-
Notifications
You must be signed in to change notification settings - Fork 841
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
[EuiDataGrid] How should the row height switcher toolbar control handle rowHeights
overrides?
#5411
Comments
…er when using `rowHeights` @see elastic#5411
* Rename styleSelector to displaySelector + update types & docs * Refactor out nested object helper - so that both the columnSelector and displaySelector can use it * Update displaySelector with conditional density/row height options + update docs: - reorder UI to match toolbar layout - fix legends + add unit tests (& improve some existing unit tests) * Add rowHeightsOptions controls to popover NYI: conditional lineCount controls + unit tests * Add conditional lineCount row and logic + fix cell height to dynamically on lineCount change * Fix styles not applying correctly for rowHeightsOptions that have undefined heights but defined rowHeightsOptions objects e.g. - empty objs, or lineHeight set but nothing else + simplify this.props * Fix multiline content not top-aligning correctly when in single/undefined mode - Multiline content includes items with `<br>`/`<p>` tags etc that end up incorrectly vertically centered to their increased height * Fix single/undefined row heights to account for passed lineHeight API + density - by giving it the same setRowHeight logic as line counts with a single line + rename recalculateLineCountHeight for clarity now that it's no longer being used for just lineCount * Add changelog entry * [PR feedback] Increase default lineCount to 2 - to make the difference more obvious when switching between single and custom * Fix changelog * Fix control column appearance by switching them back to vertical centering * Tweak various height alignments on compressed grid settings - expand buttons on single lines should now be more vertically aligned - The manual button/checkbox changes for control columns is somewhat required for auto height to not be dramatically different for single lines * Fix expand action button background color mismatch for auto/lineCount rows - when hovering over rows - on striped rows - Not caused by this PR, but this was really annoying me, haha * PR feedback: convert cell actions CSS selectors to mixin - Slightly less grody to look at in-code, and allows us to provide more comments for context The more I look at __expandButton the more I dislike the naming also but it would involve too many changes right now to rename button->actions, so I added a TODO * Fix sasslint issues * PR feedback: Change line count number to EuiRange + Remove ability to set negative or zero numbers, which causes the grid to flip out * PR feedback - remove height tweaks for compressed auto fit * [PR feedback] Remove `showStyleSelector` * Remove unused unit tests - This should have been done in 79c878d, but I missed it * [PR feedback] Intelligently disable toolbar control if all nested options are disabled Notes: - Strongly recommend turning off whitespace changes to reduce indentation noise - This could have been done at the `data_grid_toolbar` level and could be a microperf optimization to do so, but since this is a relatively unlikely edge case in any case I don't think it's worth the overoptimization when this approach is relatively straightforward to implement * Do not fall back to undefined/single for static heights * PR changelog feedback Co-authored-by: Caroline Horn <[email protected]> * Update grid density to also intelligently detect initial state + not set a button state if custom fontSize/cellPadding don't match our defined density states * [PR feedback] Improve typing to avoid any usage + improve unit tests to cover undefined nested object key case * [PR feedback] Document recommendation for disabling row height switcher when using `rowHeights` @see #5411 * [Pr feedback] Simplify getNestedObjectOptions * Add workaround for failing Cypress tests Also see https://stackoverflow.com/questions/49384120/resizeobserver-loop-limit-exceeded Co-authored-by: Caroline Horn <[email protected]>
CC @ryankeairns - any thoughts here? Does the Discover team have any plans on using both the new row height switcher and |
@constancecchen here's my design ideia. I’m more leaning into option 2. But I don’t see any problem with also allowing option 1. By default, if a consumer passed We can assume that the consumer does not want their overrides to be overridden but there are some scenarios that users might want to override that. So in case, a consumer passed a
Let me know what y'all think! 🧐 |
As I've always understood the Discover use case, the consumer would set a default (i.e. suggested) row height and the user would be able to change it to their personal preference. The switch to 'override the default row height' feels unexpected to me. If the consumer does not want the default to be overridden, then I would not expect to see any UI for Row height. In that way, perhaps it is a feature that the consumer chooses to expose/display or not. |
Sorry to be clear, the switcher always overrides So in Elizabet's mocks should likely say "Override all row heights" not "Override default row height". I think that switch works, but to be honest I'm more of a fan of reducing than I am of adding features for the sake of it. I'd be curious to hear what teams/consumers are even using the @chandlerprall, do you have any context on where the impetus for |
Thanks for clarifying. Yeah, I don't know of any specific use cases requiring the per-row settings and - barring any findings by others - would be in favor of minimizing further iteration given it's seemingly less common fit. |
Just chatted a bit more with Chandler on That upcoming functionality does raise a great question for the row height switcher: when individual rows have customizable/draggable heights, how should this row height switcher handle that? IMO, I still don't think it makes sense for the defaultHeight to override individual row height settings, but is there any way to make it clear that a specific row has a custom height set on it? And do we need to we make it clear on this toolbar control that it affects default heights only? cc @cchaos into this convo as well! |
When trying to make a decision like this, I think about the most possible user flows. In this case there are two starting points, so here are what I consider the two main possible workflows.
Both user flows expect the same outcome which, in my mind, means that this is the optimal path. I'd truly advise against having to add another toggle just to enable/disable other controls. The UI can be "smart" enough to assume intent while also providing an "out". Which I would then say we could provide a button in the popover's footer to "Reset to defaults". This would return the grid to the consumer/engineer provided defaults (including density and any future display controls) without having to refresh the page. So my suggestion summed up as tasks:
|
Closed by #5428 |
Should the row heights switcher (state set by the user):
Override the
rowHeights
overrides (state set by the consumer)?Or, should the control be automatically disabled if
rowHeights
exists (we assume that the consumer does not want their overrides to be overridden)?See #5372 (review)
The text was updated successfully, but these errors were encountered: