Ticket #203 (closed defect: fixed)

Opened 2 years ago

Last modified 2 years ago

IE: Page jumps to top when Container (H1, H2, ...) is clicked

Reported by: mh Owned by: jf.hovinne
Priority: minor Milestone: 1.0
Component: ui Version: trunk
Keywords: ie8 Cc:

Description

In IE (v8, dont know about previous versions, but assume it's the same there) the pages jumps to the top if you click on any of the containers' elements (heading 1 thru 6, paragraph, ...)

Easy solution: replace all href="#" with href=" javascript://". Then you don't even need the return false; statement anymore!

Change History

comment:1 Changed 2 years ago by mr_lundis

  • Priority changed from major to minor
  • Type changed from enhancement to defect

The "jumping" is caused by an exception thrown by IE - a fix is needed. See this discussion for further details:  http://stackoverflow.com/questions/122546/what-to-do-when-ies-movetoelementtext-spits-out-an-invalid-argument-exception

comment:2 Changed 2 years ago by mh

i think it's a good idea to change the href attribute anyways. cause all those links do not *mean* to go to an anchor (which is what href="#" stands for). this is a semantic editor after all. ;-)

comment:3 Changed 2 years ago by mr_lundis

If we're talking semantics then none of all those buttons should be links to begin with. But since IE is a pain they need to be, otherwise the styling breaks unless we introduce a bunch of unnecessary event listeners and classes.

My point was however that it's not the href value that's the real cause of the problem, but how IE handles DOM node handles. ;)

comment:4 Changed 2 years ago by mr_lundis

  • Component changed from editor to ui

comment:5 follow-up: ↓ 7 Changed 2 years ago by weswinham

I think the actual problem here might be that focus is lost when clicking the container links in ie8, the focus is lost. Maybe this is an ie8 only issue, though.

I added a patch in my github branch with a simple fix:  http://github.com/winhamwr/wymeditor/commit/16a3a6cc6e07ee5d2677f29e79f2464557ec6c01

So clicking the containers no longer jumps to the top of the screen in ie8 now.

comment:6 Changed 2 years ago by mr_lundis

  • Milestone changed from 0.5 to 1.0

comment:7 in reply to: ↑ 5 Changed 2 years ago by mr_lundis

Replying to weswinham:

I think the actual problem here might be that focus is lost when clicking the container links in ie8, the focus is lost. Maybe this is an ie8 only issue, though.

I added a patch in my github branch with a simple fix:  http://github.com/winhamwr/wymeditor/commit/16a3a6cc6e07ee5d2677f29e79f2464557ec6c01

So clicking the containers no longer jumps to the top of the screen in ie8 now.

Could you test your fix in some earlier versions of IE?

comment:8 Changed 2 years ago by weswinham

Just tested this patch in:

  • ie6
  • ie7
  • ie8 (in and out of compatibility mode)
  • chrome 6dev
  • FF 3.6

Containers work in all of them and the screen no longer jumps to the top in ie8. Also, virtualbox is awesome :)

comment:9 Changed 2 years ago by mr_lundis

Nice! I'll be including that ASAP, now I need to sleep though, otherwise I won't get up for work tomorrow!

Also, I don't know how we did testing before VirtualBox, it's awesome indeed!

comment:10 Changed 2 years ago by mr_lundis

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

Fix in r674. Moved it into the load skin method.

Note: See TracTickets for help on using tickets.