table-nav icon indicating copy to clipboard operation
table-nav copied to clipboard

Provide documentation on what the options object does

Open ElectricCoffee opened this issue 9 months ago • 2 comments

I can see that useTableNav and DataGridNav take an object of options as input, but nowhere is this documented. Instead there's inexplicably three identical README.md files in the project.

What are selectors? What does pageUpDown do? And What are the implications of setting debug to true?

ElectricCoffee avatar Apr 03 '25 08:04 ElectricCoffee

Hey @ElectricCoffee!

Thanks for the feedback, I could definitely improve the documentation. I provided the types of these objects and made the assumption that you can navigate around your IDE to read there usage as I stated in the docs. // Library is written in TS and all the options will be recommended inside your IDE

Maybe that is too much for people that just want to evaluate if they should use it 🤔 Will include more docs on the properties, or if you want to add the suggestions I am open to include any changes that will make the docs better.

To answer your questions:

useTableNav and DataGridNav take an object of options as input

Here is the input: https://github.com/konsalex/table-nav/blob/main/packages/core/src/index.ts#L6

What are selectors?

Selectors are CSS selectors that match elements for your table. The pre-defined selectors are here: https://github.com/konsalex/table-nav/blob/main/packages/core/src/selectors.ts This is used for really specific cases, if you have custom table elements, or custom focusable elements that you want to match.

pageUpDown

Page Up/Down are implementing what the Data Grid spec has defined: https://www.w3.org/WAI/ARIA/apg/patterns/grid/

So the pageUpDown is the property W3C specifies as: Moves focus down an author-determined number of rows

What are the implications of setting debug to true

Enables debugging logs to your console: https://github.com/konsalex/table-nav/blob/main/packages/core/src/index.ts#L8

Hope this helps!

konsalex avatar Apr 03 '25 13:04 konsalex

Maybe I should put this in a feature request, but it would be nice to have the ability to add additional callbacks to the various directional inputs. I had some row colouring I had to manage via a second keyboard input, which required a lot of defensive coding to make sure it followed the focus. If I could instead just hook into the library's own callbacks I'm sure it would've looked much nicer.

ElectricCoffee avatar Apr 03 '25 14:04 ElectricCoffee