LinkOpenTabProvider
Decision
The current implementation does use a querySelectorAll on the document object.
Since we cannot always ensure the layout of the page with different widget variants,
using a refObject on each link rendered inside a parent component will not be
store in the context without re-rendering the entire tree
Reason being: If component A is the grandparent of component C and the links are
rendered inside component C then you would need to send the ref back to the
grandparent (component A) to update the LinkOpenTabProvider or using some key
on the context -> const refKey = useLinkOpenTabContext("some-key") both options
are not optimal. Option two is a bit worse since the refKey could contain
multiple ref objects
Another not so optimal and also less maintainable option would be to adjust the
<Tabs /> component to change its selected key internally rather than on the
component level.
Possible improvements
-
Might be possible to always reset the openTab on every hash change. Currently, this always keep the state on the non default selected tab even on openTab change. This might be tricky to achieve without messing with the browser's native functionality (might be high effort low reward)
-
Might be able to remove the array.find() from the components which uses
useLinkOpenTabContext