-
Notifications
You must be signed in to change notification settings - Fork 4
feat(ComboBox): added clear all button for combobox and added handlin… #476
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?
feat(ComboBox): added clear all button for combobox and added handlin… #476
Conversation
…g for on click on option
… and clean up code
| private _handleClickOutOfElement = (e: MouseEvent) => { | ||
| if (!this.menuIsOpen) return; | ||
| if (!e.composedPath().includes(this)) { | ||
| this.hideMenu(); | ||
| this.hideMenu(true); | ||
| } | ||
| }; |
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.
Added the boolean here, so that when we listen to the 'sgds-hide' event, we can differentiate when it's called.
|
|
||
| option.addEventListener("keydown", (evt: KeyboardEvent) => { | ||
| if (evt.key === "Enter") { | ||
| this.close = "outside"; |
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 line is to prevent the menu from closing, as i don't want to touch the dropdown-list-element keyboard implementation
| if (this.multiSelect) { | ||
| if (!this.selectedItems.some(i => i.value === foundItem.value)) { | ||
| this.selectedItems = [...this.selectedItems, foundItem]; | ||
| setTimeout(() => (this.displayValue = "")); |
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.
I tested, when removing this seems to have not much impact. can anyone recall why we need to set this to empty string?
hmm but im not sure why point 1 is sometimes ok, sometimes not ok |
…g for on click on option
📖 Description
Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change.
Fixes # (issue)
✏️ Type of change
🧪 How Has This Been Tested?
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration
✅ Checklist: