-
Notifications
You must be signed in to change notification settings - Fork 364
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
change: [M3-7540] - Improve tags experience #10122
change: [M3-7540] - Improve tags experience #10122
Conversation
'& > button': { | ||
marginRight: theme.spacing(0.5), | ||
}, | ||
flexDirection: 'row-reverse', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense to me - good change
}, | ||
flexDirection: 'row-reverse', | ||
}, | ||
width: '100%', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, good catch. Seems like this was caused by differences in how Chrome vs Safari trigger onblur.
This is a new indication for a tag that is in progress of being deleted. Since multiple tags could be deleted at the same time, sometimes this would cause a race condition leading to inconsistent states. Fixed with a new |
@abailly-akamai Thanks for the feedback. Took it a step further and completely removed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Introducing this as a new hook as I believe it could be used wherever we asynchronously update a remote resource based on user input.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for addressing the UI issues @hkhalil-akamai - the improved UI looks great!
I've left comments about the nitty gritty of your PR, specifically around the new hook you introduced and extra complexity. Happy to pair up to discuss those further
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good. Can we add a loading state to this action?
Screen.Recording.2024-04-01.at.10.01.52.AM.mov
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for sticking with this PR for so long! Overall, I think this makes some solid improvements and clean up!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the all the improvements here! it's going a long way in improving the tagging experience, and thank you for keeping an open mind regarding the earlier refactors.
No regression found with the latest changes ✅
* Trying some stuff... * Introduce new MutationObserver hook * Use new MutationObserver hook to listen for parent becoming visible * Clean up * Improve TagCell styles for small displays * Added changeset: Tag overflow detection * Improve tags experience and replace deprecated Select with Autocomplete component * Update changeset * Remove workaround and update changeset * Fix test failure * Fix race condition with new useAtomic hook * Delete TagsPanel in favor of TagCell * Add test for useAtomic * Fix inconsistent TagCell margin bottom * Feedback @abailly-akamai * Add debouncing to useAtomic * Remove useAtomic * Fix errors due to forwarded prop * Add loading state to AddTag * Add storybook entry for TagCell * Feedback @abailly-akamai
Description 📝
Update: it appears that the React 18 upgrade resolved the underlying bug! 🪄 Keeping this PR open without the workaround since it includes some improvements to the tag UX.
Fixes a bug in theTagCell
component's overflow detection logic that caused it to sometimes render incorrectly. This bug only appeared in production builds of Cloud Manager and was caused by a parentGrid
component briefly rendering asdisplay: none
, breaking the overflow detection inTagCell
.To fix this issue, this PR introduces a somewhat convoluted workaround: upon mount,TagCell
locates its nearest ancestor in the DOM withdisplay: none
and then attaches aMutationObserver
(via the newly introduceduseMutationObserver
hook) to that element, re-computing overflow when it is finally displayed.This PR also includes improvements to the display of the
TagCell
component andAddTag
input on small screens.Changes 🔄
Fix overflow detection usinguseMutationObserver
on parent elementAddTag
input on small screensSelect
component toAutocomplete
(this also fixes a momentary flicker when adding a tag)TagsPanel
component withTagCell
(these components shared a lot of logic)Preview 📷
AddTag
unusably small on small displays:AddTag
takes up entire width:How to test 🧪
Prerequisites
As far as I am aware, this bug is only reproducible in production builds of Cloud Manager. For reproducing or testing, use either:
yarn build && yarn workspace linode-manager serve build
Reproduction steps
(For overflow detection bug)
(For style changes on small screens)
As an Author I have considered 🤔