Is there an event for change in browser setting for default font size?

Is there an event indicating that the browser default font size has been changed, that is, at the moment it is changed?

I can’t find one and it appears that there isn’t one but I figured I’d ask anyway.

I’m trying to make an extension page layout adjust better for those who need a larger font. Since the user has to leave the page to change the font, I’ve been using the onfocus and onblur event of the window. The size of an element is recorded onblur and then its size is compared to that onfocus, and, if different, then a function is invoked.

It’s not perfect though because a delay is required before querying the size of the element after the font size is changed. I don’t know why, but if query the clientWidth of the element immediately onfocus it returns the old size rather than the new. A delay of 500ms is required for a large change in font size, such as from 9px to 72px.

Also, it fires every time the page gets the focus and there is that 500ms delay before displaying the page.

Is there any method via the extension APIs that can better accomplish this?

Thank you.

If there was a setting or event for it I’d expect it to be in browserSettings and there’s no such thing there…

I’d assume a font size change would trigger a resize or scroll on many pages though?

Thank you.

I tried resize before posting and the event fires only when the window has been resized and the font change doesn’t affect the window size. I don’t think a resize event fires on an element other than window, because that would probably be all that is needed. I didn’t see that as a choice in the mutation observer either. There is a resize observer but firefox has question marks for whether or not it works.

I didn’t try a scroll event but did notice that if the vertical scroll is at the top before a font change then it remains at the top after the font change. I suspect it might fire at times but not all times needed.

Oh well, can’t expect to have everything. Thanks for answering.