WordPress.org

Make WordPress Core

Opened 6 years ago

Closed 6 years ago

#27198 closed enhancement (fixed)

Improve pushState/hashChange routing in Appearance > Themes

Reported by: gcorne Owned by: markjaquith
Milestone: 3.9 Priority: normal
Severity: normal Version: 3.8.1
Component: Themes Keywords: has-patch
Focuses: javascript Cc:
PR Number:

Description

Since the Backbone.History in Backbone version 1.1.1 and above includes better support for query strings, we can improve the routing UX of Appearance > Themes.

  • Use pushState throughout the Appearance > Themes.
  • Only use replaceState when adding characters to the search term.
  • Support browsers that don't support pushState()

See #26543 and #25963 for additional context.

Attachments (6)

27198-01.patch (5.8 KB) - added by gcorne 6 years ago.
27198-02.patch (5.8 KB) - added by gcorne 6 years ago.
27198.diff (5.6 KB) - added by adamsilverstein 6 years ago.
27198-03.patch (6.4 KB) - added by gcorne 6 years ago.
27198-04.patch (6.4 KB) - added by gcorne 6 years ago.
27198-05.patch (832 bytes) - added by gcorne 6 years ago.

Download all attachments as: .zip

Change History (18)

@gcorne
6 years ago

#1 @gcorne
6 years ago

  • Milestone changed from Awaiting Review to 3.9

Added 27198-01.patch based on 26543-ie8-routing-fix.diff, which I think is ready to go.

@gcorne
6 years ago

#2 follow-up: @gcorne
6 years ago

27198-02.patch makes sure that the overlay closes when hitting the search route if present.

#3 in reply to: ↑ 2 @adamsilverstein
6 years ago

Replying to gcorne:

27198-02.patch makes sure that the overlay closes when hitting the search route if present.

Thank you.

I tested and this works great! Its awesome to see real query string routes and History intact.

I uploaded a patch (27198.diff) that includes a little minute whitespace additions.

What does this part do? event.which !== 15

@gcorne
6 years ago

#4 follow-up: @gcorne
6 years ago

27198-03.patch addresses the following feedback from markjaquith:

  • Searching and then clicking the back button, and then searching again should reset this.searching so that we pushSate instead of replaceState when searching again
  • Clearing a search should pushState instead of replaceState

Also, uses correct keyCode for enter.

#5 in reply to: ↑ 4 @adamsilverstein
6 years ago

Replying to gcorne:

27198-03.patch addresses the following feedback from markjaquith:

  • Searching and then clicking the back button, and then searching again should reset this.searching so that we pushSate instead of replaceState when searching again
  • Clearing a search should pushState instead of replaceState

Also, uses correct keyCode for enter.

Looks good to me, 13 makes more sense than 15 :)

@gcorne
6 years ago

#6 @gcorne
6 years ago

27148-04.patch only enables routing if the browser supports pushState and cleans up how the root is specified.

#7 @markjaquith
6 years ago

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

In 27268:

Improve pushState, replaceState and routing for Themes page

  • Uses pushState() generally
  • Uses replaceState() when updating a search query (so no history cruft from typing)

fixes #27198. props gcorne, adamsilverstein.

#8 @matveb
6 years ago

Looks good. Side note for future reference: these changes also add ?s= routes which were missing before with the server side url parsing. Quite good timing we had with Backbone 1.1.1. :)

#9 follow-up: @kovshenin
6 years ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

The overlay doesn't close when clicking back through history, breaks scrolling. To reproduce:

  • Have enough themes available to get a scrollbar
  • Go to Appearance - Themes, select any theme to show the details modal
  • Hit the browser back button and try to scroll

@gcorne
6 years ago

#10 in reply to: ↑ 9 @gcorne
6 years ago

Replying to kovshenin:

The overlay doesn't close when clicking back through history, breaks scrolling.

Thanks for catching/reporting. 27198-05.patch fixes the issue.

This ticket was mentioned in IRC in #wordpress-dev by gcorne. View the logs.


6 years ago

#12 @nacin
6 years ago

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

In 27306:

Themes screen: Clicking back through history should properly close the overlay.

props gcorne.
fixes #27198.

Note: See TracTickets for help on using tickets.