v17development / flarum-blog

The Flarum Blog extension
https://discuss.flarum.org/d/25392-blog-adds-a-blog-section-to-your-community
MIT License
46 stars 20 forks source link

Modals don't focus the first field when Blog is enabled #149

Closed clarkwinkelmann closed 2 years ago

clarkwinkelmann commented 2 years ago

When this extension is enabled, all Flarum modals stop focusing the first field after opening.

I tried with both Firefox and Chrome, and I tried disabling almost all other extensions.

The easiest way to notice it is to open the login modal and notice no fields are focused. But all other modals I tried also don't focus.

Extension version 0.6.4 Flarum version 1.4.0 PHP version 8.0.21

EDIT: I can't find any obvious cause for the error.

The focus usually happens in Modal.oncreate, which doesn't seem to be overridden by Blog https://github.com/flarum/framework/blob/v1.4.0/framework/core/js/src/common/components/Modal.tsx#L145

iamdarkle commented 2 years ago

I've noticed this for a long time (more than a year, maybe it was like this since the blog extension came out?), but I never stopped to look for the cause because at the time I discarded the most obvious ones, I just tried it and it turns out it was the blog all this time, thanks Clark for stopping to look into it.

iamdarkle commented 2 years ago

Hey @clarkwinkelmann, I just upgraded to Flarum 1.5 and it seems that with the new modals (I mean the big update for stacked modals) this problem no longer occurs, could you confirm this from your side as well?

clarkwinkelmann commented 2 years ago

I just tested on Flarum 1.5 and it seems to be fine on my end as well.

From what I understand the issue was in the stackable modal feature and already fixed in Flarum master at the time this issue was created, it was just a problem with the "backport" used by Blog. But since 1.5 it will use the built-in feature from Flarum which doesn't have that issue.

I'll close this issue since it's now irrelevant. If there are still any issues they will have to be fixed in Flarum core anyway.