josdejong / svelte-jsoneditor

A web-based tool to view, edit, format, repair, query, transform, and validate JSON
https://jsoneditoronline.org
Other
820 stars 108 forks source link

Issue with focus and blur when first renderring #231

Closed Eyreba closed 1 year ago

Eyreba commented 1 year ago

environment: Platform: Mac os 13.2 Browser: Chrome 109.0.5414.119 Framework: vue3 + ts

Problem detail: When first renderring editor, it has auto focused, but when i clicked other doms, it cannot trigger blur event. But it's useful after first blur. Could you please add a prop that could control the editor auto focus or not when thr first time renderring.

josdejong commented 1 year ago

Thanks for reporting.

How can I reproduce your issue? In which mode are you opening the editor?

Eyreba commented 1 year ago

Thanks for replying. I opened the editor with text mode, and just add onBlur event in props, you will find that when the first time you click blank space, it will not trigger the onBlur event. But when you focus and click blank space again, it will trigger onBlur event.

josdejong commented 1 year ago

Thanks. It turned out that the code editor was needlessly grabbing focus when created.

josdejong commented 1 year ago

Fix is published now in v0.15.0

Eyreba commented 1 year ago

I'm very thankful for your helping 👍