Skip to content
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

Icon-click and icon-right-click events trigger focus on an element that might not be there anymore. #2272

Closed
ehutch79 opened this issue Feb 26, 2020 · 1 comment · Fixed by #2278

Comments

@ehutch79
Copy link

Overview of the problem

Buefy version: [0.8.11]
Vuejs version: [2.6.11]
OS/Browser: any

Description

I am looping over an array, creating inputs with v-for, where the input has these attributes set:

icon-right="times"
icon-right-clickable
@icon-right-click="removeBreak(item, index)"

the removeBreak removes the item from from the array, which removes the input.

Then, after the array is spliced, the event handler tries to focus the input.

This is normally correct behavior, but assumes that the input still exists, when it might not.

Expected behavior

Buefy should check that the input exists before calling .focus()

Actual behavior

Buefy blindly calls .focus() on the input generating the event.

@ehutch79
Copy link
Author

The relevant line is https://github.com/buefy/buefy/blob/dev/src/components/input/Input.vue#L240

Currently I am getting around this by triggering the actual removal in a $nextTick()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant