Skip to content

Toolbox category touch interaction broken on iPhone Chrome (iOS mobile) #664

Description

@lawsie

Information generated after a lot of going round in circles with Claude:

Platform:
iPhone, Chrome on iOS. iPad Chrome partially affected.

Bugs:

  • Can't close a category by tapping it again — tapping an open category closes it momentarily then it reopens (iOS phone only). Desktop and iPad Chrome work correctly.
  • Wrong category opens when tapping below an expanded subcategory — present on both iPhone and iPad Chrome; desktop works correctly.

What was tried:
In toolbox.js, CustomCollapsibleToolboxCategory.createDom_ — added a lastPointerWasTouch flag so that touch events skip the custom pointerdown/click handlers and let Blockly's own onClick_ handle the toggle. I reverted this.

Key diagnostic facts:

  • iPhone Chrome fires pointerdown → touchstart → pointerup → touchend — no click event
  • iPad Chrome apparently fires a click event after touch (explaining why the fix works there)
    Holding and dragging to a different spot before releasing keeps the category closed on iPhone — so the reopen is triggered by something that fires on the category element itself on/after release
  • categoryHasFocus_() always returns false on touch because touch doesn't set DOM focus
    Relevant code: toolbox.js around line 5091 (createDom_ event listeners), and CustomCollapsibleToolboxCategory.setSelected at line 5052 (forces setExpanded(true) whenever isSelected — potential contributor to reopen).

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    Status
    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions