-
Notifications
You must be signed in to change notification settings - Fork 87
Update Lookup
for SLDS2
#482
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
base: support-slds-2
Are you sure you want to change the base?
Conversation
reg-suit detected visual differences. Check this report, and review them. 🔴🔴🔴🔴🔴🔴🔴🔴🔴🔴🔴🔴🔴🔴🔴🔴🔴 🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵🔵 What do the circles mean?The number of circles represent the number of changed images.🔴 : Changed items, ⚪ : New items, ⚫ : Deleted items, and 🔵 Passed items How can I change the check status?If reviewers approve this PR, the reg context status will be green automatically. |
- add SLDS-compliant combobox markup structure - implement basic aria attributes (role, aria-expanded, aria-haspopup, etc.) - add keyboard navigation (arrow keys, Enter, Escape) - support search functionality with dropdown display - include listHeader and listFooter support - add loading state display - maintain existing API compatibility for basic features - temporarily comment out future features in stories to avoid type errors
- add unified a11y ID generation (labelId, scopeId) - implement proper label-input association with FormElement - add common a11y props (ariaLabelledBy, ariaControls, ariaHaspopup) - improve ID generation with fallbackId pattern - enhance WAI-ARIA compliance for better screen reader support
- add scope-related props (scopes, targetScope, onScopeSelect, etc.) - implement scope state management with controlled values - add scope selection UI with icon-only display (slds-has-icon-only) - implement scope dropdown with entity icons and selection states - add blur-to-close functionality for scope dropdown - support Multi Entity Lookup pattern with combobox-group layout - maintain existing API compatibility for single-scope lookups
- replace manual slds-icon_container spans with container={true} - unify data item icons to use Icon component container prop - unify search icon to use Icon component container prop - unify scope dropdown icon to use Icon component container prop - simplify code by leveraging Icon component functionality - ensure consistent Icon usage across all components
- add selected state combobox with SLDS-compliant markup structure - implement entity icon and selected value display with slds-media layout - add remove selection button with close icon and accessibility - use slds-lookup__result-text for selected value display - implement conditional rendering between selected and search states - add onRemoveSelection handler for clearing selection - maintain proper aria attributes for selected state combobox - follow reference markup pattern for selected state display
- add iconAlign prop to control search icon position (left/right) - implement dynamic className generation for icon positioning - add slds-input-has-icon_left/right and slds-input__icon_left/right classes - restore Stories functionality by uncommenting scope-related features - restore iconAlign: 'left' in WithSearchIconInLeft story - restore scopes: LOOKUP_SCOPES in MultiScope story - restore scope event handlers in LookupControlled component - complete all planned Lookup component features and improvements
289545a
to
296b514
Compare
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.
Scope dropdown of lookup should be keyboard navigatable (by up/down arrow, return key, esc key, and so on), like current dropdown button implementation.
I've tried to add keyboard handlers, so could you take a look again...? |
</ul> | ||
</div> | ||
)} | ||
</div> |
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.
Divide into sub components as the former implementation does, not having large JSX tree.
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.
FYI, I've removed |
src/scripts/Lookup.tsx
Outdated
const onSelect = useEventCallback((entry: LookupEntry | null) => { | ||
onSelect_?.(entry); | ||
}); | ||
const renderListHeader = () => { |
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.
No need to be a function, just assign to var like const listHeaderItem = !listHeader ? null : <li ... />
or simply inlining with root tree would be enough.
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.
src/scripts/Lookup.tsx
Outdated
setScopeOpened(!scopeOpened); | ||
} | ||
}, | ||
isIgnoreTabNavigation: () => { |
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.
In terms of naming conventions, isTabNavigationIgnored
or ignoreTabNavigation
would be more grammatically appropriate.
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.
src/scripts/Lookup.tsx
Outdated
setScopeFocusedIndex(-1); | ||
} else { | ||
const prevIndex = Math.max(scopeFocusedIndex - 1, 0); | ||
setScopeFocusedIndex(prevIndex); |
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.
This approach is setting react state and triggers re-render to Lookup
component, which may or may not introduce some difficulties (especially regarding to the focus of elements). If you are going to keep the focus index in state, scoping the handler to a hook and capsulate it to the sub component that involves the focus would be preferable.
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.
src/scripts/Lookup.tsx
Outdated
e.preventDefault(); | ||
e.stopPropagation(); | ||
onResetSelection?.(); | ||
const createKeyHandler = (config: KeyHandlerConfig) => { |
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.
This logic can be directly implemented using hook.
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.
626fa5c
to
3664759
Compare
What I did
layout
propx-small
sizexx-small
sizeReference
https://v1.lightningdesignsystem.com/components/lookups/