microsoft / fluentui

Fluent UI web represents a collection of utilities, React components, and web components for building web applications.
https://react.fluentui.dev
Other
18.26k stars 2.7k forks source link

[Bug]: Datagrid row-focused (OnRowFocus) only fires once #30940

Open ra-one opened 4 months ago

ra-one commented 4 months ago

Library

Web Components (@fluentui/web-components)

System Info

NA

Are you reporting Accessibility issue?

no

Reproduction

https://github.com/ra-one/DataGridMRE

Bug Description

Actual Behavior

The onrowfocus event only fires once

Expected Behavior

The onrowfocus event should fires when row is selected/clicked

Sorry if some details are not available for this bug report, as i I use fluentui-blazor.

I have a data-grid and when i click on a row the event OnRowFocus for blazor and i believe row-focused for web-components should get fired but it only happens on first click, on any subsequent click no events are fired unless i click on different cell in the row, which is not behaviour i think is correct.

Attched video shows the behaviour, I am clicking row-5 multiple times but PreviousId and SelectedId does not change unless I click on date column and same for row-6.

https://github.com/microsoft/fluentui/assets/2285281/541d7945-cb1b-47ee-9315-ae19e93849a8

I have attched blazor code as minimal reproduction example DataGridMRE.zip

Logs

No response

Requested priority

Blocking

Products/sites affected

No response

Are you willing to submit a PR to fix?

no

Validations

Wuz3t commented 4 months ago

I assume it is working as intended because you focus on row "x" and if you don't click elsewhere row "x" is already focused so the event won't be fired. I also would like to have "selected" method instead of "focused"...

ra-one commented 4 months ago

@Wuz3t i think i would agree, i think it would be nice to have onClick event. My use case is that on first click the item/row gets selected and on second click it shoud trigger other things. For example imagine a grid of books on first click i can selected it which will display all the info like authour and title and may be description, and then on second click on same selected row it will open the book to read. The user may read the info and then click so there may be delay hence need of onClick which should always fire regardless if row is selected or not.