Skip to content

Conversation

@drgrice1
Copy link
Member

The latest version of JXSGraph is 1.12.2. However, that version (and all versions after 1.11.1) have an issue with tab order when keyboard events are enabled. Basically, it is impossible to use shift-tab to progress in reverse in the tab order. See jsxgraph/jsxgraph#773. So to work around that I had to override the board's keyDownListener method with one that does not call preventDefault on a keydown event that comes from a tab key being used.

Another thing that is a bit annoying with versions 1.11.1 and later is that you now have to set the tabindex on elements that are not fixed yourself. By default they set the tabindex to -1, which means they are not in the tab order. So gt.definingPointAttributes is now a function, and if it is called with gt.isStatic true, a tabindex of -1 is used, but if gt.isStatic is false, then a tabindex of 0 is used (and so those points will be keyboard focusable).

@drgrice1 drgrice1 force-pushed the upgrade-jsxgraph-to-latest branch 2 times, most recently from 00141d9 to 00bf372 Compare December 22, 2025 17:12
The latest version of JXSGraph is 1.12.2.  However, that version (and
all versions after 1.11.1) have an issue with tab order when keyboard
events are enabled.  Basically, it is impossible to use shift-tab to
progress in reverse in the tab order.  See jsxgraph/jsxgraph#773.
So to work around that I had to override the board's `keyDownListener`
method with one that does not call `preventDefault` on a keydown event
that comes from a tab key being used.

Another thing that is a bit annoying with versions 1.11.1 and later is
that you now have to set the tabindex on elements that are not fixed
yourself.  By default they set the tabindex to -1, which means they are
not in the tab order.  So `gt.definingPointAttributes` is now a
function, and if it is called with `gt.isStatic` true, a tabindex of -1
is used, but if `gt.isStatic` is false, then a tabindex of 0 is used
(and so those points will be keyboard focusable).
@drgrice1 drgrice1 force-pushed the upgrade-jsxgraph-to-latest branch from 00bf372 to 71294b6 Compare December 30, 2025 14:04
@pstaabp
Copy link
Member

pstaabp commented Dec 30, 2025

I notice that is both the develop version and this branch that in a simple problem with a graph tool, that the tab order starts with tex outside the problem, then any points on any tools, then all of the labels.

I was expecting to go through the buttons as well to be able to focus. This doesn't have to do with this PR, but just noticed it.

@drgrice1
Copy link
Member Author

With the develop branch the tab order is really not working. If you graph a line, for instance, set focus to somewhere before the graph tool, and use the tab button, then focus first moves to the first point on the line, then it moves to the MathJax text and cycles through all of that on the graph (axes labels first, then tick labels), then focus moves to the tool buttons. One of the problems is that it skips over the second point on the graphed line. Another problem is that if you use shift-tab anywhere in that cycle, focus never goes back to either of the points on the graphed line. They are skipped entirely in the reverse order. Furthermore, if you stop with focus on that first point on the line or if you click to focus the other point, and then try to use shift-tab, the focus doesn't even move at all. It is stuck on the point. You can still go forward in the tab order with the tab key, but not backward with shift-tab.

With this pull request the issues mentioned above are fixed. Tab order works both forward and backward as it should.

I don't know what you mean by "I was expecting to go through the buttons as well to be able to focus". It does go through the tool buttons below, both with the develop branch and this pull request.

@pstaabp
Copy link
Member

pstaabp commented Dec 30, 2025

I don't know what you mean by "I was expecting to go through the buttons as well to be able to focus". It does go through the tool buttons below, both with the develop branch and this pull request.

This looks like another Safari quirk/bug. Skips the buttons in Safari. I notice it works as expected in Chrome.

@drgrice1
Copy link
Member Author

That is certainly odd. The buttons are just standard HTML buttons which should be in the tab order, and should work in all browsers in the expected way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants