Removing tabIndex from Datatable header

UI Components for React
Post Reply
Posts: 2
Joined: 07 Nov 2022, 04:03

07 Nov 2022, 04:12

Hi everyone.
I am on the hunt for a way to remove the tabIndex or set the tabIndex to -1 for a Prime Datatable column headers.
We have two Datatables that are part of a form that is utilised by keyboard heavy dataentry people.
As a result we have received a request to remove the requirement to tab through the table headers with sort enabled.

I have been mucking around for hours and thus far I have been unable to find a way to remove the tabIndex. I even looked at installing jquery (shock horror) into our react environment to facilitate this requirement.
That made me feel dirty though so if anyone can offer any advice on how I might be able to do this please let me know.

Posts: 2
Joined: 07 Nov 2022, 04:03

08 Nov 2022, 02:16

Best I have come up with so far is to use vanilla javascript to select the class .p-sortable-column and loop and manually set the the tabIndex in a useEffect in a functional component or onComponentDidMount in a class. it works but its not exactly pretty.

Posts: 3373
Joined: 22 Apr 2013, 15:48

13 Nov 2022, 14:41

That is about the best you can do. Those fields are tabbable for keyboard compliance since they are sortable they must be clickable and navigable by visually impaired users.

So your solution is similar to something I have done in PrimeFaces JSF before to remove all the tabIndexes.
PrimeFaces Developer | PrimeFaces Extensions Developer
GitHub Profile:
PrimeFaces Elite 12.0.0 / PF Extensions 12.0.1
PrimeReact 8.6.1

Post Reply

Return to “PrimeReact”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 3 guests