WordPress.org

Make WordPress Core

Opened 2 years ago

Closed 2 years ago

Last modified 2 years ago

#22716 closed defect (bug) (fixed)

Exiting new media modal pushes user to bottom of page in Firefox

Reported by: tomthewebmaster Owned by: markjaquith
Milestone: 3.5 Priority: normal
Severity: normal Version: 3.5
Component: Media Keywords: has-patch needs-testing commit
Focuses: Cc:

Description

When exiting the new media modal in Firefox 17.0 on a Mac, I am pushed to the bottom of the screen. Steps to reproduce:

  • Open a new post ("Add New Post")
  • Press "Add Media"
  • Press the upper-right-hand "x" to close the media window

At this point, one's page is pushed to the bottom, regardless of where the page position was prior to opening the media modal. I'm not sure this is intended behavior, as this doesn't happen in most other browsers. I believe I also saw this once in Safari 6.0.2 but was not able to do again.

Attachments (2)

22716.diff (375 bytes) - added by johnkleinschmidt 2 years ago.
Focus patch
22716.2.diff (1.6 KB) - added by koopersmith 2 years ago.

Download all attachments as: .zip

Change History (20)

comment:1 @nacin2 years ago

  • Version set to trunk

I know helenyhou uses Firefox, and she has not reported this. Try checking plugin conflicts?

comment:2 @DrewAPicture2 years ago

  • Keywords dev-feedback added

I can reproduce this closing the modal via both QuickPress and the post editor in Firefox. It's similar behavior to what I noted in the second bullet point in comment:ticket:21776:48, only in this case there's no hash being appended to the URL.

comment:3 @DrewAPicture2 years ago

A short screencast to illustrate the point: http://screencast.com/t/nv4aQsAGFRLc

comment:4 @tomthewebmaster2 years ago

All plugins are disabled.

comment:5 in reply to: ↑ description @tomthewebmaster2 years ago

Replying to tomthewebmaster:

When exiting the new media modal in Firefox 17.0 on a Mac, I am pushed to the bottom of the screen. Steps to reproduce:

  • Open a new post ("Add New Post")
  • Press "Add Media"
  • Press the upper-right-hand "x" to close the media window

At this point, one's page is pushed to the bottom, regardless of where the page position was prior to opening the media modal. I'm not sure this is intended behavior, as this doesn't happen in most other browsers. I believe I also saw this once in Safari 6.0.2 but was not able to do it again.

comment:6 @helenyhou2 years ago

I can reproduce, but it must be pretty new unintentional behavior. Definitely had not noticed it before. Happens on any screen, with any method of closing the modal, including insertion or setting the featured image.

comment:7 @koopersmith2 years ago

Actually, it appears that it's happening on open, not close. Watch the page behind the modal.

comment:8 @nacin2 years ago

  • Milestone changed from Awaiting Review to 3.5

@johnkleinschmidt2 years ago

Focus patch

@koopersmith2 years ago

comment:9 @koopersmith2 years ago

Thanks for the patch, johnkleinschmidt. Unfortunately, removing .focus() is insufficient, as that will break keyboard shortcuts.

comment:10 @koopersmith2 years ago

  • Keywords has-patch needs-testing added; dev-feedback removed

attachment:22716.2.diff records the original scroll position of the window and restores the scroll position on close. It also locks scrolling on the document, so scrolling in the modal will not scroll the document.

comment:11 @DrewAPicture2 years ago

22176.2.diff fixes it for me.

comment:12 @sabreuse2 years ago

Fixes it for me too.

comment:13 @johnkleinschmidt2 years ago

I figured there was a good reason for the focus call and didn't think about needing it for keyboard shortcuts.

Your patch fixes it for me too.

comment:14 @helenyhou2 years ago

Works for me in FF. Tested in iPad for fun, with no ill effects noted, although you can still scroll the document there.

comment:15 @ocean902 years ago

Suprise: Fixes it for me too. (Also no side effects in IE)

comment:16 @markjaquith2 years ago

  • Keywords commit added

Fixes it. No ill effects in Chrome. Locks scrolling of background document in Chrome and FF (which is a win for a serious annoyance!).

comment:17 @markjaquith2 years ago

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

In 23029:

Fix a Firefox "scroll to bottom" bug when launching the media modal.

  • Records main document scroll position when launching media modal.
  • Restores position when media modal is closed.
  • Also locks background document scrolling while media modal is open, preventing inadvertent scrolling there.

props koopersmith. fixes #22716

comment:18 @azaozz2 years ago

Some background: this was happening because when calling focus() the browser's built-in scrollIntoView kicks in and the modal is at the bottom of the page in the html. So the browser was mis-calculating the position/visibility of the modal and trying to scroll to it.

Note: See TracTickets for help on using tickets.