[6.x] Fix validation rules being lost when saving without pressing enter - #15022
Merged
Merged
Conversation
The rule builder's parameter input committed its value on blur, but listeners passed to the Input component land on its outer wrapper via attribute fallthrough, and blur doesn't bubble, so it never fired. Clicking Save without pressing enter silently dropped the typed rule. Use focusout, which bubbles and does reach the wrapper. The ref focus calls are optional-chained since focusout can also fire while the field settings stack is closing, after the refs are gone. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When you add a parameterized validation rule (like
after:{this}.start_time) and click Save without pressing enter first, the typed rule is silently dropped. The toast says "Saved" but the rule never reaches the YAML. Reported with{this}but it affects any rule entered through the parameter input.The input commits its value on blur, but listeners passed to the
Inputcomponent land on its outer wrapper via attribute fallthrough, and blur doesn't bubble, so the handler never fired. Enter worked because keydown does bubble up to the wrapper. Switching tofocusoutcommits the rule on the way out, whichever way you leave the field. The two ref focus calls are optional-chained since focusout can also fire while the field settings stack is closing.Worth noting: the underlying component behavior (non-bubbling listeners passed to
Inputnever fire) still exists and also affects the focus/blur emits of the text-based fieldtypes. Fixing that properly touches the publish field focus handling, so it felt like its own PR rather than a drive-by here.Fixes #14806
🤖 Generated with Claude Code