# Any reference to what has changed with KeyboardFocusTraverser from JUCE 6.0.8 to JUCE 6.1.2?

**URL:** <https://forum.juce.com/t/any-reference-to-what-has-changed-with-keyboardfocustraverser-from-juce-6-0-8-to-juce-6-1-2/49010>\
**Category:** General JUCE discussion\
**Created:** [November 30, 2021, 3:20am UTC](https://forum.juce.com/t/any-reference-to-what-has-changed-with-keyboardfocustraverser-from-juce-6-0-8-to-juce-6-1-2/49010 "2021-11-30T03:20:38Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![stephenk](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/stephenk/32/15198_2.png) [@stephenk](https://forum.juce.com/u/stephenk)\
**Post date:** [November 30, 2021, 3:20am UTC](https://forum.juce.com/t/any-reference-to-what-has-changed-with-keyboardfocustraverser-from-juce-6-0-8-to-juce-6-1-2/49010/1 "2021-11-30T03:20:38Z")

</div>

Is there any reference to what has changed with KeyboardFocusTraverser from JUCE 6.0.8 to JUCE 6.1.2?

I’ve recently update my projects to JUCE 6.1.2 and having a lot of problems with KeyboardFocusTraverser with the tab key - a lot of stuff I previously implemented just doesn’t work any more.

---

<div class="post-metadata">

**Author:** ![ed95](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/ed95/32/7635_2.png) [@ed95](https://forum.juce.com/u/ed95)\
**Post date:** [November 30, 2021, 9:33am UTC](https://forum.juce.com/t/any-reference-to-what-has-changed-with-keyboardfocustraverser-from-juce-6-0-8-to-juce-6-1-2/49010/2 "2021-11-30T09:33:17Z")

</div>

Quite a lot has changed in the component `FocusTraverser` code since adding accessibility support. It’s difficult to say what your problem may be without seeing any code or more details of the specific issues you are having. Can you provide a minimal example?

It’s also worth looking at the breaking changes document in the repo:

> <https://github.com/juce-framework/JUCE/blob/e6ec1819ec0a59a7cfe82d8ce72367f64e0a4bb0/BREAKING-CHANGES.txt#L239>

---

<div class="post-metadata">

**Author:** ![stephenk](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/stephenk/32/15198_2.png) [@stephenk](https://forum.juce.com/u/stephenk)\
**Post date:** [November 30, 2021, 7:04pm UTC](https://forum.juce.com/t/any-reference-to-what-has-changed-with-keyboardfocustraverser-from-juce-6-0-8-to-juce-6-1-2/49010/3 "2021-11-30T19:04:46Z")

</div>

Thanks Ed. I did read the breaking changes.

I’m not using createFocusTraverser() or a custom traverser.

I was using `setFocusContainer(true)` in several places which I replaced with `setFocusContainerType(FocusContainerType::keyboardFocusContainer)`. That’s correct, right?

Here’s some more detail:

In JUCE 6.0.8, I used to have some debug code that I placed inside `FocusHelpers::getIncrementedComponent()`, that would print out for me the traversal of components via the Tab Key.

In JUCE 6.1.2, this is all changed/rewritten. It seems the place you would do this is now `FocusHelpers::navigateFocus()`, but in here it now traverses every single component, not just the ones that I have told to `setWantsKeyboardFocus()`.

I may need to change my approach, but I was doing some things like:

Having a custom component that has `setWantsKeyboardFocus(true)` so that clicking on it unfocuses other components, but then using `focusGained()` and `focusChangedByTabKey` to pass the keyboard focus to the next sibling component. In other words, clicking it grabs focus so that it unfocused any other component. However, if you tab to it, the tab key effectively skips over it to the next component. But this doesn’t seem to work the same way at all.

```auto
void IncDec::focusGained (FocusChangeType cause)
{
    if (cause == focusChangedByTabKey)
    {
        auto direction = ComponentPeer::getCurrentModifiersRealtime().isShiftDown() == false;
        moveKeyboardFocusToSibling(direction);
    }
}

```

Now, in JUCE 6.1.2, it ends up somewhere else entirely, I’m not sure how… because it seems that `moveKeyboardFocusToSibling()` no longer does the same thing. I’m trying to step through what’s going on but it’s complicated.

My understanding so far (I may be wrong) is that there used to only be the concept of KeyboardFocus Traversal; now however, there is “Accessibility Focus Traversal” and Keyboard Traversal is only a subset of that.

But is there any way to exclude a component from Accessibility Focus Traversal? I haven’t really tried the screen reading stuff yet; I’m still developing the app and I barely had the tab key changing focus the way I wanted it. But let’s say you don’t want a screen reader to notice a certain component. Is there a method to remove it from the transversal completely?

---

<div class="post-metadata">

**Author:** ![ed95](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/ed95/32/7635_2.png) [@ed95](https://forum.juce.com/u/ed95)\
**Post date:** [December 1, 2021, 10:08am UTC](https://forum.juce.com/t/any-reference-to-what-has-changed-with-keyboardfocustraverser-from-juce-6-0-8-to-juce-6-1-2/49010/4 "2021-12-01T10:08:00Z")

</div>

Again it’s hard to say without seeing the actual code, but it sounds like `setFocusContainerType()` isn’t the method you should be using here. This method will mark the component as a container within which keyboard focus will be passed around when using the tab and shift+tab keys - it effectively “traps” the keyboard focus and will round-robin traverse its children. In your case it sounds like you want to be setting the parent component as a keyboard focus container and then calling `setWantsKeyboardFocus()` on the children that you want to be navigable within that container.

---

<div class="post-metadata">

**Author:** ![stephenk](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/stephenk/32/15198_2.png) [@stephenk](https://forum.juce.com/u/stephenk)\
**Post date:** [December 1, 2021, 3:37pm UTC](https://forum.juce.com/t/any-reference-to-what-has-changed-with-keyboardfocustraverser-from-juce-6-0-8-to-juce-6-1-2/49010/5 "2021-12-01T15:37:14Z")

</div>

Yes, I am using setFocusContainerType() on the parent component.

Is there no reference on how Accessibility works now?

Is there a way to exclude components from being traversed period? Keyboard focus or other?

---

<div class="post-metadata">

**Author:** ![ed95](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/ed95/32/7635_2.png) [@ed95](https://forum.juce.com/u/ed95)\
**Post date:** [December 1, 2021, 3:52pm UTC](https://forum.juce.com/t/any-reference-to-what-has-changed-with-keyboardfocustraverser-from-juce-6-0-8-to-juce-6-1-2/49010/6 "2021-12-01T15:52:43Z")

</div>

> [@stephenk](#):
>
> Is there no reference on how Accessibility works now?

The `AccessibilityDemo` project in the `examples/GUI` directory of the repo is a good starting point and the classes are pretty thoroughly documented.

> [@stephenk](#):
>
> Is there a way to exclude components from being traversed period? Keyboard focus or other?

A component is considered focusable if it is visible and enabled, so either making it invisible or disabling it with `setVisible()` and `setEnabled()`, respectively, will cause a component to be ignored by the default focus traverser. Alternatively you can provide your own `FocusTraverser` implementation for more complex behaviours.
