-
Notifications
You must be signed in to change notification settings - Fork 7
Add disableClear property to hide clear button in igc-combo component #1896
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: master
Are you sure you want to change the base?
Conversation
Co-authored-by: kdinev <1472513+kdinev@users.noreply.github.com>
Co-authored-by: kdinev <1472513+kdinev@users.noreply.github.com>
src/components/combo/combo.ts
Outdated
part="clear-icon" | ||
@click=${this.handleClearIconClick} | ||
?hidden=${this._selection.isEmpty} | ||
?hidden=${this._selection.isEmpty || this.disableClear} |
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.
@copilot Do the disableClear check first, because if the property is set to true, then the logic doesn't need to get to an isEmpty
check ever. It would be slightly more performant.
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.
Updated the condition order to check disableClear
first for better performance: ?hidden=${this.disableClear || this._selection.isEmpty}
(commit: b4b73b5)
Co-authored-by: kdinev <1472513+kdinev@users.noreply.github.com>
disableClear
property to combo componentSummary
Added a new
disableClear
boolean property to theigc-combo
component that hides the clear button (X icon) when set totrue
.Changes:
disableClear
property with@property
decorator, attribute namedisable-clear
, default valuefalse
renderClearIcon()
to hide button whenthis.disableClear || this._selection.isEmpty
(optimized check order)Usage:
or
The implementation is minimal, follows existing patterns, and maintains backward compatibility (default is
false
). The condition check order has been optimized to checkdisableClear
first for better performance.Original prompt
Fixes #1516
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.