Make WordPress Core

Opened 11 years ago

Closed 11 years ago

#36018 closed defect (bug) (fixed)

Ensure autofocus for dynamically-created panels, sections, and controls

Reported by: westonruter Owned by: westonruter
Priority: normal Milestone: 4.5
Component: Customize Version: 4.1
Severity: normal Keywords: has-patch commit
Cc: Focuses: javascript

Description

At the moment, autofocus via URL params (#28650) only works for panels, sections, and controls which are defined statically up-front. Any constructs not created statically will be stripped from exporting to JS. Additionally, from the JS side, if any of these constructs do not exist by ready, they will also be ignored.

Autofocus should work for anything that gets created with JS.

Attachments (3)

36018.0.diff​ (2.1 KB ) - added by westonruter 11 years ago.
36018.1.diff​ (2.2 KB ) - added by westonruter 11 years ago.
Clean up comment
36018.2.diff​ (2.7 KB ) - added by westonruter 11 years ago.
Further simplify

Download all attachments as: .zip

Change History (6)

@westonruter
11 years ago

#1 @westonruter
11 years ago

  • Keywords has-patch added
  • Owner set to westonruter
  • Status new → accepted

See 36018.0.diff​.

The PHP logic for calculating $can_autofocus is being over zealous in its checks. If the panel, section, or control doesn't exist on the JS side (due to not existing or due to a capability failure), there will not be anything to focus on.

@westonruter
11 years ago

Clean up comment

#2 @westonruter
11 years ago

  • Keywords commit added

@westonruter
11 years ago

Further simplify

#3 @westonruter
11 years ago

  • Resolution → fixed
  • Status accepted → closed

In 36796:

Customize: Ensure autofocus deep-linking applies for dynamically-created panels, sections, and controls.

Removes overly-zealous filtering of autofocus panels, sections, and controls which are unrecognized or for which the user doesn't have the capability to focus (in which case it would no-op anyway). Also defers autofocus logic until instances are created, even after initial ready event. This ensures that autofocus can apply for any panels, sections, or controls that get created via the loaded preview.

See #28650.
Fixes #36018.

Note: See TracTickets for help on using tickets.