mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
Accessibility: Moved Component::isCurrentlyBlockedByAnotherModalComponent() check into AccessibilityHandler::getCurrentState() to determine whether handler is considered focusable and removed Component::inputAttemptWhenModal() call
This prevents components from taking focus when they are blocked by another modal component by excluding them from the list of child handlers returned by AccessibilityHandler::getChildren() and fixes an issue with modal components being dismissed by handlers.
This commit is contained in:
parent
4c133c281e
commit
928cc5f80c
1 changed files with 7 additions and 12 deletions
|
|
@ -74,7 +74,10 @@ AccessibilityHandler::~AccessibilityHandler()
|
|||
//==============================================================================
|
||||
AccessibleState AccessibilityHandler::getCurrentState() const
|
||||
{
|
||||
auto state = AccessibleState().withFocusable();
|
||||
AccessibleState state;
|
||||
|
||||
if (! component.isCurrentlyBlockedByAnotherModalComponent())
|
||||
state = state.withFocusable();
|
||||
|
||||
return hasFocus (false) ? state.withFocused() : state;
|
||||
}
|
||||
|
|
@ -210,7 +213,7 @@ std::vector<AccessibilityHandler*> AccessibilityHandler::getChildren() const
|
|||
|
||||
if (auto* handler = findEnclosingHandler (focusableComponent))
|
||||
{
|
||||
if (! isParentOf (handler))
|
||||
if (! handler->getCurrentState().isFocusable() || ! isParentOf (handler))
|
||||
return;
|
||||
|
||||
if (auto* unignored = getFirstUnignoredDescendant (handler))
|
||||
|
|
@ -283,16 +286,8 @@ void AccessibilityHandler::grabFocusInternal (bool canTryParent)
|
|||
{
|
||||
if (getCurrentState().isFocusable() && ! isIgnored())
|
||||
{
|
||||
const auto blockedByModal = component.isCurrentlyBlockedByAnotherModalComponent();
|
||||
|
||||
if (blockedByModal)
|
||||
Component::getCurrentlyModalComponent()->inputAttemptWhenModal();
|
||||
|
||||
if (! blockedByModal || ! component.isCurrentlyBlockedByAnotherModalComponent())
|
||||
{
|
||||
takeFocus();
|
||||
return;
|
||||
}
|
||||
takeFocus();
|
||||
return;
|
||||
}
|
||||
|
||||
if (isParentOf (currentlyFocusedHandler))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue