WordPress.org

Make WordPress Core

Opened 3 years ago

Closed 3 years ago

Last modified 3 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 3 years ago.
Focus patch
22716.2.diff (1.6 KB) - added by koopersmith 3 years ago.

Download all attachments as: .zip

Change History (20)

#1 @nacin
3 years ago

  • Version set to trunk

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

#2 @DrewAPicture
3 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.

#3 @DrewAPicture
3 years ago

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

#4 @tomthewebmaster
3 years ago

All plugins are disabled.

#5 in reply to: ↑ description @tomthewebmaster
3 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.

#6 @helenyhou
3 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.

#7 @koopersmith
3 years ago

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

#8 @nacin
3 years ago

  • Milestone changed from Awaiting Review to 3.5

@johnkleinschmidt
3 years ago

Focus patch

@koopersmith
3 years ago

#9 @koopersmith
3 years ago

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

#10 @koopersmith
3 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.

#11 @DrewAPicture
3 years ago

22176.2.diff fixes it for me.

#12 @sabreuse
3 years ago

Fixes it for me too.

#13 @johnkleinschmidt
3 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.

#14 @helenyhou
3 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.

#15 @ocean90
3 years ago

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

#16 @markjaquith
3 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!).

#17 @markjaquith
3 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

#18 @azaozz
3 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.