Closed Bug 1171189 Opened 10 years ago Closed 10 years ago

Custom context menu fires when closing the banner on Twitter

Categories

(Firefox for iOS :: General, defect)

Other
iOS
defect
Not set
normal

Tracking

()

RESOLVED FIXED
Tracking Status
fxios + ---

People

(Reporter: wesj, Assigned: st3fan)

Details

(Whiteboard: noteworthy)

Attachments

(1 file, 1 obsolete file)

Twitter shows a "Get the app" banner on top (no matter how many times you hide it, they keep showing it). Tapping it now always causes the context menu to appear.
tracking-fxios: --- → ?
Assignee: nobody → sarentz
Status: NEW → ASSIGNED
This seems to be a banner that Twitter adds. Not the standard banner that Apple can add on top of a page. You can see the difference between the two by for example going to http://m.telegraaf.nl - note the UI is a little different, it for example shows the number of stars and full app name and publisher.
Also, the 'Get the app' banner does not seem to show in the Simulator. So if in doubt if the bar is something the website is doing or if it is the native iOS provided one, run the app in the simulator and see what happens there. So I think for this bug we can ignore the fact that the banner keeps showing on Twitter, I assume they do it on purpose, and instead we should focus on the context menu showing on a non-long-press.
The banner is a Twitter specific banner and not the built-in one that apps can ask to be shown in the `WKWebView`. The underlying problem here is that we also try to show the context menu on script links that are handled internally by the application. This patch has a basic fix for that where I check if the link's `href` is set to `#`. I don't know the web platform well enough if this is the best check to do. *Note that this fix is not twitter specific. This will work on any script-backed link.*
Attachment #8627804 - Flags: review?(bnicholson)
Attachment #8627804 - Flags: feedback?(aaron.train)
Comment on attachment 8627804 [details] [review] PR: https://github.com/mozilla/firefox-ios/pull/657 I think the bigger issue here is the fact that the context menu shows at all with a regular tap -- we should only be showing the context menu for long taps. What's happening is that the element is removed on touchdown, so when you release within the 500ms timeout period, touchend is never called to cancel the context menu dialog. wesj pointed out that attaching the touchend/touchmove listeners directly to the elements (rather than having global capture on the window) will correctly fire the touchend/touchmove events, even if the element is removed from the document. So, in short, the "proper" way to fix this would be to attach the touchend/touchmove listeners to event.target directly, doing so inside of touchstart. I created a simple page here to help with testing (which also works in the simulator): https://people.mozilla.org/~bnicholson/test/touchend.html
Attachment #8627804 - Flags: review?(bnicholson)
Thanks :bnicholson that is super useful.
Attachment #8627804 - Attachment is obsolete: true
Attachment #8627804 - Flags: feedback?(aaron.train)
Comment on attachment 8631210 [details] [review] PR: https://github.com/mozilla/firefox-ios/pull/691 Looking good -- left a couple more comments in the PR.
Attachment #8631210 - Flags: review?(bnicholson) → feedback+
Comment on attachment 8631210 [details] [review] PR: https://github.com/mozilla/firefox-ios/pull/691 Brian, this now seems to work well on your test page and on m.twitter.com. Can you take a quick peek to see if I did anything crazy. JavaScript is not my greatest skill :-)
Attachment #8631210 - Flags: review?(bnicholson)
Attachment #8631210 - Flags: review?(bnicholson)
Attachment #8631210 - Flags: review+
Attachment #8631210 - Flags: feedback+
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Whiteboard: noteworthy
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: