[wp-trac] [WordPress Trac] #38954: Customize Menus: menu item property previewing is not debounced
WordPress Trac
noreply at wordpress.org
Sun Nov 27 19:06:32 UTC 2016
#38954: Customize Menus: menu item property previewing is not debounced
-------------------------------+-----------------------------
Reporter: celloexpressions | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Future Release
Component: Customize | Version: 4.6.1
Severity: normal | Resolution:
Keywords: reporter-feedback | Focuses:
-------------------------------+-----------------------------
Changes (by westonruter):
* keywords: needs-patch => reporter-feedback
Comment:
@celloexpressions I'm seeing the same expected behavior in Firefox. From
your screencast it seems you're entering content slower than 250ms. If you
hit the keys more rapidly then you'll see the request deferred. Easy way
to check this is to open the dev tools and inspect the label `input`
element for a given nav menu item. Then enter the following JS into your
console, where `$0` is a reference to the selected element in the dev
tools elements panel (both in Chrome's Dev Tools and Firefox's Inspector):
{{{#!js
timeoutId = setInterval( function() { jQuery( $0 ).val( Math.random()
).trigger( 'change' ); }, 200 );
}}}
The `refreshBuffer` is 250 milliseconds, so this should result in the
debouncing never allowing a request to go through, until you do
`clearInterval( timeoutId )`.
In contrast, if you try an interval greater than 250ms, then you'll see a
refresh with each change as you are noticing:
{{{#!js
timeoutId = setInterval( function() { jQuery( $0 ).val( Math.random()
).trigger( 'change' ); }, 300 );
}}}
The only way to resolve this would be to increase the `refreshBuffer` to
500ms or maybe 1s. Perhaps as well the `refreshBuffer` could be made to be
somewhat more dynamic, where it variably increases to 1s when typing into
a text field whereas it remains 250ms when making a more atomic change,
like changing a dropdown selection.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/38954#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list