ni / nimble

The NI Nimble Design System
https://nimble.ni.dev
MIT License
29 stars 9 forks source link

TableCellView tabbableChildren should support changing dynamically #2210

Open msmithNI opened 1 week ago

msmithNI commented 1 week ago

🧹 Tech Debt

Currently TableCellView tabbableChildren is assumed to be static (or at least, the number of elements in it not changing). This may not be true generally - changes to table/ column configuration may necessitate it changing (more/less interactive elements in a cell; alternatively, an interactive element may get disabled, in which case it's no longer tabbable, and should no longer be included).

We should consider making this property @observable, and updating keyboard focus as needed if it changed (re-focus cell if it changes or the current focus is no longer valid, potentially).

See PR comment thread

msmithNI commented 1 week ago

Of note, we may be avoiding a potential error case related to this just due to the focusedRecycleCallback right now - if an anchor is focused when data changes, it'll be blurred, in which case focus resets to the cell. So we shouldn't end up in a case where cellContentIndex is out of bounds even if tabbableChildren changed (anchor link present in initial data, not in updated data).