Repository navigation
Reuse an existing attribute when a variation card is renamed to its name - #372
Merged
Merged
Conversation
Typing the name of an existing attribute in a product variation card used to show a blocking duplicate-name error. Now, on blur, the card switches to that attribute when no values are selected: its values, type and stored name load, and Apply uses it (replacing the applied attribute when editing one). - Name matches an existing attribute while values are selected: keep the "An attribute with this name already exists." error. - Name matches an attribute already on the product: show "This attribute is already added to this product." and load nothing. - Unique new name with selected values: still creates a new attribute with copies of the values; the original keeps its values. Covered by tests. - The name check is one shared classifier used by the name input and Apply. Also fix the chip color picker in the value field. Picking a color closed the picker and opened the values dropdown, because picker events bubble through the React portal to the MultiSelect box click handler, and the dismissing click then opened the panel. MultiSelect now ignores clicks from outside its DOM and skips the open click that follows a chip layer being dismissed. The chip layer signal is opt-in, so other MultiSelect users are unchanged. Includes the OpenSpec change, archived, and the synced product-variations-card spec.
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
Name reuse
On blur of the name input, a name that matches an existing store attribute (trimmed, case-insensitive) is handled by what is selected:
+ Add new, presets,+ Addpicks and editing an applied attribute (Apply then replaces the old attribute, no new attribute is created).The name check is one shared classifier, used by the name input and by the Apply backstop, so the two cannot disagree.
Color picker
Events from the portalled picker bubbled through React to the
MultiSelectbox click handler, which opened the values dropdown and dismissed the picker. The click that dismissed the picker could also open the dropdown.MultiSelectignores box clicks whose target is outside its DOM.MultiSelectskips the open click that follows a pointer down while a chip layer was open. The signal is opt-in (useMultiSelectChipLayer), so otherMultiSelectusers are unchanged.Testing
eslintonfeatures/productsandcomponents/ui: clean.vitestonfeatures/productsandcomponents/ui: 374 tests pass. New tests cover each name case, the copy-not-move behavior, and the color picker. The two picker tests fail without theMultiSelectfix.features/settingstest files fail becausesettings-search-index.jsonis missing, andtscreportsColumnMetaerrors indata-tableand bulk-edit files.Includes the archived OpenSpec change
reuse-existing-attribute-on-renameand the syncedproduct-variations-cardspec.