-
-
Notifications
You must be signed in to change notification settings - Fork 363
fix(AutoComplete): missing value when click delete item #5817
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -41,17 +41,19 @@ export function init(id, invoke) { | |
| if (duration > 0) { | ||
| ac.debounce = true | ||
| EventHandler.on(input, 'keydown', debounce(e => { | ||
| handlerKeydown(ac, e); | ||
| handlerKeydown(e); | ||
| }, duration, e => { | ||
| return ['ArrowUp', 'ArrowDown', 'Escape', 'Enter', 'NumpadEnter'].indexOf(e.key) > -1 | ||
| })) | ||
| } | ||
| else { | ||
| EventHandler.on(input, 'keydown', e => { | ||
| handlerKeydown(ac, e); | ||
| handlerKeydown(e); | ||
| }) | ||
| } | ||
|
|
||
| EventHandler.on(input, 'keyup', e => handlerKeyup(ac, e)); | ||
|
|
||
| ac.triggerBlur = () => { | ||
| el.classList.remove('show'); | ||
| const triggerBlur = input.getAttribute('data-bb-blur') === 'true'; | ||
|
|
@@ -117,7 +119,7 @@ export function init(id, invoke) { | |
| }); | ||
| } | ||
|
|
||
| const handlerKeydown = (ac, e) => { | ||
| const handlerKeyup = (ac, e) => { | ||
| const key = e.key; | ||
| const { el, input, invoke, menu } = ac; | ||
| if (key === 'Enter' || key === 'NumpadEnter') { | ||
|
|
@@ -162,6 +164,9 @@ const handlerKeydown = (ac, e) => { | |
| invoke.invokeMethodAsync('TriggerDeleteCallback', input.value); | ||
| } | ||
| } | ||
| } | ||
|
|
||
| const handlerKeydown = e => { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. issue (bug_risk): Undefined reference to ac in handlerKeydown. The keydown event handler now calls handlerKeydown(e), but this function uses 'ac' (e.g. in ac.triggerBlur()) without receiving it as a parameter. This is likely to result in an undefined reference. Consider passing 'ac' to handlerKeydown similarly to how it's done for the keyup handler or capturing it via a closure. |
||
| if (e.key === 'Tab') { | ||
| ac.triggerBlur(); | ||
| } | ||
|
|
@@ -193,6 +198,7 @@ export function dispose(id) { | |
| } | ||
| EventHandler.off(input, 'change'); | ||
| EventHandler.off(input, 'keydown'); | ||
| EventHandler.off(input, 'keyup'); | ||
| EventHandler.off(menu, 'click'); | ||
| Input.dispose(input); | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.