Open Bug 1410553 Opened 7 years ago Updated 6 years ago

blog.m.o binds category click listeners multiple times when resizing window

Categories

(Infrastructure & Operations :: Blogs, task)

task
Not set
normal

Tracking

(Not tracked)

People

(Reporter: shobson, Assigned: craigcook)

Details

Steps to reproduce:

1) open https://blog.mozilla.org/blog/2017/10/18/mozilla-brings-microsoft-google-w3c-samsung-together-create-cross-browser-documentation-mdn/
2) open RWD
3) clode RWD
4) click on "Categories" in the black sub menu bar

Expected result:
- drop down menu opens and displays categories

Actual result:
- categories menu opens and then immediately closes

I suspect some kind of problem with both touch and mouse events being sent. But I'm not even in RWD mode anymore.
Wow, thanks for filing!  This is quite strange!

It doesn't seem specific to touch per se.  Here's a similar STR without exiting RDM:

1. Go to https://blog.mozilla.org/blog/2017/10/18/mozilla-brings-microsoft-google-w3c-samsung-together-create-cross-browser-documentation-mdn/
2. Enter RDM
3. Resize to a large width so that "Categories" toggle appears
4. Click on Categories

By debugging the JS for the toggle, it seems like 2 "click" events are received by JS instead of 1.

By default, touch mode in RDM is off, so this issue seems unrelated to touch simulation.
Priority: -- → P1
Summary: Odd touch behaviour after closing RWD mode → Multiple click events received after entering RDM (remains after exiting)
Appears to be a longstanding issue, not a regression.
Ah, looks like it's actually a site bug!

The function `initCategories` which adds the click listener (line 48 of https://ffp4g1ylyit3jdyti1hqcvtb-wpengine.netdna-ssl.com/wp-content/themes/frontierline/js/global.js?ver=2.1) can be called multiple times when the window size changes.  For example:

1. Set window width larger than 760 px
2. Go to https://blog.mozilla.org/blog/2017/10/18/mozilla-brings-microsoft-google-w3c-samsung-together-create-cross-browser-documentation-mdn/
  * initCategories is called once on load, but a MQ listener waits for size changes
3. Resize the window below 760 px, and then above 760 px again
  * initCategories is called again, doubling the listeners

I'll move to Websites :: Other for now, but maybe you know a better place for this?
Component: Developer Tools: Responsive Design Mode → Other
Flags: needinfo?(shobson)
Priority: P1 → --
Product: Firefox → Websites
Summary: Multiple click events received after entering RDM (remains after exiting) → blog.m.o binds category click listeners multiple times when resizing window
Version: 58 Branch → unspecified
Assignee: nobody → craigcook.bugz
Flags: needinfo?(craigcook.bugz)
I don't know a better place for it.
Flags: needinfo?(shobson)
Component: Other → Blogs
Product: Websites → Infrastructure & Operations
You need to log in before you can comment on or make changes to this bug.