[WC-3501]: fix(combobox-web): fix inverted editability logic#2332
Open
r0b1n wants to merge 2 commits into
Open
[WC-3501]: fix(combobox-web): fix inverted editability logic#2332r0b1n wants to merge 2 commits into
r0b1n wants to merge 2 commits into
Conversation
The `conditionally` branch returned `expression.value` directly, so a truthy value (meaning "editable") made the widget read-only, and vice versa. Fixed by returning `true` only when the expression is not `true`, and added unit tests for all `getReadonly` branches.
This comment has been minimized.
This comment has been minimized.
- Split "loading or unavailable" test cases into separate loading and unavailable variants to make coverage explicit - Add changelog entry for the attribute-presence bug that bypassed custom editability conditions
aecac76 to
2351483
Compare
Contributor
AI Code Review
What was reviewed
Skipped (out of scope): CI checks could not be retrieved (permission denied); please confirm they are green before merging. Findings
|
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.
Summary
getReadonly()where theconditionallyeditability mode had inverted logic:expression.value = true(meaning "editable") was being returned directly as the read-only flag, making the widget read-only when it should be editable, and vice versa.targetAttributecaused the function to return early withfalse(editable), bypassing the custom editability condition entirely. NowtargetAttributeonly short-circuits when it is explicitly read-only.getReadonly.Root cause
Two issues in
getReadonly:targetAttributepresence meant any editable attribute would always report the widget as editable, ignoring theneverorconditionallysettings.conditionallybranch returnedcustomEditabilityExpression.value ?? truedirectly, where the expression represents editability (true = editable), so the boolean was inverted.