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

Modal closes on child component input event #2597

Closed
NoahStahl opened this issue Feb 15, 2019 · 8 comments · Fixed by #2608
Closed

Modal closes on child component input event #2597

NoahStahl opened this issue Feb 15, 2019 · 8 comments · Fixed by #2608

Comments

@NoahStahl
Copy link

After upgrading to rc12, I see behavior where an input event emitted in a component within a b-modal causes the modal to close. The basic structure is: b-modal contains b-form contains a custom component with a v-model (array of strings in this case). When a method in custom component is called to emit an 'input' event to update the value prop supplied as v-model (removing an item from the array), the modal closes.

No errors are shown in console. My environment is Chrome 72 on Windows 10.

This began with rc12, worked fine in rc11. I've reverted in the meantime. Apologies not supplying repro code, but hoping the description might help clue in to what might be going on. Great work on this library!

@tmorehouse
Copy link
Member

tmorehouse commented Feb 15, 2019

Is your custom component Emitting a click event (native)?

@jacobmllr95
Copy link
Member

@tmorehouse This seems to be related to #2591.

@tmorehouse
Copy link
Member

@jackmu95 Will have to dig in to this a bit more.

@NoahStahl
Copy link
Author

The #2591 behavior looks like what I'm seeing. My component does involve a button click that calls a method to emit event:

<b-button
    title="Remove"
    variant="danger"
    size="xs"
    class="float-right"
    v-b-tooltip.topright
    @click="onRemove(id)">

private onRemove(removedId: string) { this.$emit("input", this.value.filter(item => item !== removedId)); // Update parent model }

tmorehouse added a commit that referenced this issue Feb 16, 2019
Move clickout listener to the modal-backdrop element

Closes: #2597
@tmorehouse
Copy link
Member

PR #2608 may fix this issue. It fixes the original issue addresses by #2591, without any breaking changes.

@tmorehouse
Copy link
Member

@NoahStahl does your component remove the button that has the click handler, once clicked? If so, then #2608 should address your issue.

You can try the playground with this PR at https://deploy-preview-2608--bootstrap-vue.netlify.com/play

@NoahStahl
Copy link
Author

@tmorehouse Awesome, thank you! Yes, the click does cause the clicked button to be removed in my scenario.

@tmorehouse
Copy link
Member

OK good, the PR should fix your issue.

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

Successfully merging a pull request may close this issue.

3 participants