-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Update/form token field onblur #54445
Conversation
Size Change: +27 B (0%) Total Size: 1.62 MB
ℹ️ View Unchanged
|
Flaky tests detected in 8cb9edb. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/6178239193
|
e291597
to
81876cd
Compare
b41360a
to
85f4c5e
Compare
8cb9edb
to
d408594
Compare
@aaronrobertshaw, @kevin940726 now that the main category PR is merged I have rebased this against trunk - it was all tested and approved here, but backed that out as this is better as single commit into trunk - so could do with a quick retest before merging into trunk when yo have time. |
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 splitting this one out on its own @glendaviesnz 👍
LGTM!
✅ Has changelog
✅ Unit tests pass
✅ Component behaves as advertised in Storybook examples
✅ Test well in the post editor
Added a dev note in the PR description |
What?
Adds a
tokenizeOnBlur
prop. This is a copy of #53976 as merging that into the feature branch was not the best approach, so reverted that and will rebase this against trunk and merge into trunk separately once the rest of the pattern category feature is merged.Why?
To allow consuming components to specify that any
incompleteTokenValue
is saved when the field loses focus. The main purpose for this is to prevent users saving the new add patterns model with unsaved categories added.How?
If
tokenizeOnBlur
istrue
thenaddNewToken
is run inonBlur
Testing Instructions
Create pattern
menu option'
click outside the box so it loses focusScreenshots or screencast
Before:
form-token-before.mp4
After:
form-token-after.mp4
✍️ Dev note
A new
tokenizeOnBlur
prop has been added toFormTokenField
, causing the component to tokenize its current input instead of discarding it when losing focus.This is particularly useful when
FormTokenField
is used in places like modals, where the user may press a button causing the modal to close andFormTokenField
to lose focus before its input could be tokenized.