Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#15866 closed defect (fixed)

Textarea: hang when Viewport resize event soon after startup

Reported by: bill Owned by: doughays
Priority: undecided Milestone: 1.8.1
Component: Dijit - Form Version: 1.8.0
Keywords: Cc:
Blocked by: Blocking: #15616

Description (last modified by bill)

If there's a viewport resize event soon after page load, it can cause an endless loop in the Textarea resize code. Calling Textarea.resize() triggers a Textarea.onresize event, which calls Textarea.resize() again and so forth.

Apply attached patch to Viewport.js and then run dijit/tests/form/test_Textarea.html on IE8. See the CPU peg at 100% and the page get stuck while downloading images for the test.

Attachments (2)

viewport.patch (1.4 KB) - added by bill 5 years ago.
make Viewport start monitoring viewport size earlier than before, which triggers a "spurious" viewport resize event when a scrollbar appears
15866.patch (4.9 KB) - added by doughays 5 years ago.
fix to review

Download all attachments as: .zip

Change History (8)

Changed 5 years ago by bill

make Viewport start monitoring viewport size earlier than before, which triggers a "spurious" viewport resize event when a scrollbar appears

comment:1 Changed 5 years ago by bill

  • Blocking 15616 added
  • Description modified (diff)

comment:2 Changed 5 years ago by bill

In [29507]:

For dojo core and dijit, use require(dojo/domReady!?, cb) rather than ready(cb) so that dojo code can run against other dojo loaders.

Exceptions:

  • robot.initRobot() related code that checks when page inside of iframe has finished initializing
  • dijit-legacy-requires back-compat code for synchronous mode, which load modules that weren't explicitly required (ex: how dijit/_WidgetBase loads dojo/_base/manager)
  • dojo/parser's parseOnLoad: true support
  • dojo-config-require sync mode operation

This change depends on dojo/domReady! executing it's callbacks in the order they were registered. To ensure that client-defined callback code executes after the callbacks inside of dojo/dijit, client code should either continue using dojo/ready, or use a nested require(dojo/domReady!?, ...) inside of the original require that loads the modules:

require([...], function(...){
         require(["dojo/domReady!"], ...)
}

Further, when the client code needs to run the parser and then run another block of code, it should be done like:

require([..., "dojo/parser"], function(..., parser){
     parser.parse().then(...);
}

Viewport.js needed a setTimeout() to workaround bug #15866. It should probably be removed when that bug is fixed.

Refs #15616, #15866 !strict. Changes on trunk/.

Changed 5 years ago by doughays

fix to review

comment:3 Changed 5 years ago by doughays

  • Milestone changed from tbd to 1.8.1

bill, I attached a patch that I was hoping you could test out. The textarea native onresize event should not have been connected to in addition to Viewport.on/resize

comment:4 Changed 5 years ago by bill

Yup, that definitely fixes the problem, thanks!

comment:5 Changed 5 years ago by doughays

  • Resolution set to fixed
  • Status changed from new to closed

In [29530]:

Fixes #15864, #15866. Remove textarea.onresize event trap since the Viewport.on/resize handles this effectively to avoid a resize loop.

comment:4 Changed 5 years ago by doughays

In [29956]:

Fixes #16334. Refs #15866, #15864. Remove onscroll event handler to avoid resize event loop.

Note: See TracTickets for help on using tickets.