[Bug] Button click events cut off by Grid edges when translating it outside Grid cell bounds
#6,760 opened on 2019/07/03
Repository metrics
- Stars
- (5,644 個のスター)
- PR merge metrics
- (30d に merged PR はありません)
説明
Description
Translating a Button view outside the edges of a Grid cell cuts off the 'Clicked' event bounds. The event bounds do translate with the Button properly, but the event does not function outside of the Grid cell it's placed in. I can click on the parts of the Button inside the parent Grid cell, but I can't click on the parts outside of the cell bounds.
This is shown in the solution file I attached. There's also a video.
- The left side Button is in Grid row 0 and uses TranslationY="40" to push it outside the bottom of its cell. It is obscured by row 1. (I think this is expected behavior, but I'm not sure.)
- The right side Button is in Grid row 1 and uses TranslationY="-40" to push it outside the top of its cell. It is not obscured visually, which I would expect in this case. However I am unable to trigger the click event on the top portion of the Button.
Further Remarks:
- I'm inclined to think this is an issue with Grid (not Button), because the issue also occurred when I tried it with a Slider view. I couldn't click and slide it when outside its parent Grid cell.
- It doesn't seem to be platform-specific or device-specific as the bug occurs on both Android and iOS
Steps to Reproduce
- Open solution file GridTranslation_Bug.
- Build and Run the program on an Android simulator (or iOS).
- Try to click both buttons inside and outside of their parent Grid cells.
- Check the Console output for click events (I added a counter). Events will only register when Button is clicked inside its parent Grid cell's bounds.
Expected Behavior
I should be able to use translation to move the Button outside its parent view and still trigger the click event by clicking anywhere within the button bounds.
Actual Behavior
In the translated Button, only the Button space within the bounds of the parent Grid cell is clickable. Outside of the Grid bounds, the Button does not receive a click event.
Basic Information
- Version with issue: Xamarin.Forms (4.1.0.555618)
- Last known good version: ???
- IDE: Visual Studio for Mac Community 8.1.3 (build 19)
- Platform Target Frameworks:
- iOS: 12.2
- Android: API 28
- Nuget Packages: Project defaults
- Xamarin.Essentials (1.1.0)
- Xamarin.Forms (4.1.0.555618)
- Affected Devices: Android, iOS