Closed Bug 229015 Opened 21 years ago Closed 21 years ago

OnResize event should fire when Text Zoom level is changed.

Categories

(Core :: DOM: Events, defect)

x86
Windows 98
defect
Not set
normal

Tracking

()

RESOLVED WONTFIX

People

(Reporter: mozilla, Unassigned)

Details

User-Agent:       Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.0.0+) Gecko/20020518
Build Identifier: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.0.0+) Gecko/20020518

When the size of text is changed, the page is forced to reflow.  However
JavaScript's resize event is not called, which means that scripts can't respond
to the sudden change in the effective size of the window.

Reproducible: Always

Steps to Reproduce:
1. Add this to a body tag: onresize="alert('resize')"
2. Select 'View', 'Text Zoom', 'Larger'.

Actual Results:  
No alert box appears.  Nothing happens.

Expected Results:  
The onresize event should have fired, and an alert box should have appeared.

Technically the window hasn't resized, but since everything inside the window is
how a different size the effect is the same.  JavaScript needs to be able to
trap this so that scripts can reposition elements or perform other visual cleanups.
Neither Opera 7 nor MSIE 5 fire the resize event on text resize.  Even though
both browsers reflow the page.  I think this is a bug in all three browsers, but
I thought it worth mentioning.
The resize event means the window actually got resized.  In this case, it did
not.    Firing the resize event in this case would actually break pages that
expect the resize event to fire when a resize actually happened...

There are many reasons a reflow could occur that have nothing to do with the
window being resized; font size changes are just one way it could happen.  It
sounds like you want to detect all such, which would require a rather more
comprehensive solution than just ad-hoc firing of resize events.
Status: UNCONFIRMED → RESOLVED
Closed: 21 years ago
Resolution: --- → WONTFIX
It might be worth pointing out that Netscape 4 *does* call the resize event when
the font size is changed.
That looks to me like a hack netscape 4 had to put in to make itself reflow the
document (it catches the resize event itself and starts a reflow, then notices
there is a new font size set in preferences).  Any sort of modern browser has
style-dependent ways of triggering reflow in general, so doesn't need that hack...
I'm implementing a "documet overview" feature where a script displays a small
copy of the large main document (think spreadsheet or map) fixed in the corner
of the screen.  On top of this a partially-transparent coloured block indicates
which part of the document is currently visible.  This updates on scroll and
resize events, and ought to update when the text size is changed, if that were
possible.  I'd support firing either scroll or resize events in this case, or
inventing some new mechanism.
See also bug 303405, "Dispatch an event when the text zoom level changes".
You need to log in before you can comment on or make changes to this bug.