fix(menu): ipad menu item click #5829
                
     Draft
            
            
          
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
Description
Issue
Menu items (
<sp-menu-item>) in<sp-action-menu>were not registering click events on iPad devices, while the same items wrapped in<sp-menu-group>worked correctly. This issue was reported in GitHub Issue #5706.Symptoms
<sp-action-menu>don't fire click eventspointerdownandpointerupevents fire correctly<sp-menu-group>Root cause
The issue stemmed from an incorrect device detection strategy that didn't properly account for tablet devices with touch input.
Technical details
Device detection query
This query only matched devices with:
iPad devices don't match because their screen width is typically 768px-1024px.
The shouldSupportDragAndSelect flag
In
packages/picker/src/InteractionController.ts, the code set:Since iPad didn't match
IS_MOBILE,shouldSupportDragAndSelectwas set totrue.Event handling conflict
In
packages/menu/src/Menu.ts:When
shouldSupportDragAndSelect = true:handlePointerupprocesses the selection and setspointerUpTargethandleClicksees thatpointerUpTarget === event.targetand returns earlyWhy menu-group worked
When menu items are wrapped in
<sp-menu-group>, the additional DOM wrapper causes theevent.targetin the click handler to sometimes differ from thepointerUpTargetset in the pointerup handler, allowing the click to proceed.Solution
We introduced a new
IS_TOUCH_DEVICEmedia query that detects any device with touch input, regardless of screen size:This query matches:
The
PickerBaseclass now includes anisTouchDeviceproperty:The menu's
shouldSupportDragAndSelectproperty is set directly in the template when the menu is rendered:This ensures that on all touch devices (including iPads), the menu uses click events instead of the drag-and-select pattern, preventing the event handling conflict.
Motivation and context
Related issue(s)
Screenshots (if appropriate)
Author's checklist
Reviewer's checklist
patch,minor, ormajorfeaturesManual review test cases
iPad Menu Item click test
Descriptive Test Statement
Device review