brianvoe / slim-select

Slim advanced select dropdown
http://slimselectjs.com
MIT License
1.03k stars 195 forks source link

The change event triggered on the original select doesn't bubble #524

Closed pepa-linha closed 2 months ago

pepa-linha commented 6 months ago

There was already an issue for bubbles created here

but in the current version the event is not with bubbles again:

https://github.com/brianvoe/slim-select/blob/master/src/slim-select/select.ts#L300

I supposed it should be

this.select.dispatchEvent(new Event('change'), { bubbles: true })
frenkel commented 3 months ago

I'm affected by this as well and have created #547 based on your suggestion. It does indeed fix it for me.

brianvoe commented 3 months ago

I dont mind adding the pr I just need a test added for it.

frenkel commented 2 months ago

@brianvoe I'm trying to write tests for this and while doing so I found out that my original PR contained an error. Instead of this:

    this.select.dispatchEvent(new Event('change'), { bubbles: true })

it should have been:

    this.select.dispatchEvent(new Event('change', { bubbles: true }))

Sorry about that, I messed up in the Github web ui I guess.

Also, I don't think this fixes the case where a users selects an item. Can you help me find where the original change event is created for when a user selects an item? I'll then create a PR with tests for it.

brianvoe commented 2 months ago

no worries. I made the fix for you