dotnet / dotnet/maui

[MAC-CATALYST] PressesBegan getting triggered twice on Space bar press.

Open
#9,282 5 comments 0 reactions 0 assignees View on GitHub
area-layout partner platform/macos s/triaged s/verified t/bug t/desktop
Dominant language
C#
Stars
23.3k
Forks
2k
Avg merge
1d 15h
Merged PRs (30d)
290

Description

### Description

On pressing Space bar, PressesBegan getting triggered twice. On second call key informations were null.

### Steps to Reproduce

1. Create a layout class with VerticalStackLayout or any view as base class.
2. Create a native view(LayoutView or based on VirtualView) and connect it to VerticalStackLayout via custom handler derived from LayoutHandler.
3. Do the following in NativeViewClass
- Override CanBecomeFirstResponder and return true;
- Set UserInteractionEnabled to True.
- Override TouchesBegan and call this.BecomeFirstResponder().
- Override PressesBegan,PressesEnded,PressesCancelled.
4. Now register the custom handler in MauiProgram.
5. ADD the Demolayout as content to the MainPage
6. Run the sample.
7. Now touch the app, and press SpaceBar.

I have attached sample for reference
[DemoLayout.zip](https://github.com/dotnet/maui/files/9289557/DemoLayout.zip)

### Version with bug

6.0.486 (current)

### Last version that worked well

6.0 Release Candidate 2 or older

### Affected platforms

macOS

### Affected platform versions

IOS 15.12.0.2

### Did you find any workaround?

_No response_

### Relevant log output

_No response_

Contributor guide

Open the contributing guide

Research direction

Reproduce the issue using the attached DemoLayout sample, starting with NativeViewClass and its TouchesBegan, PressesBegan, PressesEnded, and PressesCancelled overrides. Trace how the custom handler is registered in MauiProgram and connected through LayoutHandler to MainPage. Done means pressing Space once produces one PressesBegan event with populated key information on Mac Catalyst.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, ios
Domain
mobile-dev
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.