diff options
author | Caolán McNamara <caolanm@redhat.com> | 2013-08-19 14:16:16 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2013-08-19 14:18:20 +0100 |
commit | 650f7c168160fe5118b7b4e362b82438244ec5ba (patch) | |
tree | 5f4e3361e9fd73f3e7973840232ea1d8755bab76 /vcl/source/window/window.cxx | |
parent | 508e8dd2e2cf54e3c0867b0a8340e477da3afee5 (diff) |
prefer first visible label when presented by multiple ones
Change-Id: Ie3e5e3b8a68fdfa7b5a0c985b49f69fc87449ee0
Diffstat (limited to 'vcl/source/window/window.cxx')
-rw-r--r-- | vcl/source/window/window.cxx | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx index dec55d113303..df1456d2b147 100644 --- a/vcl/source/window/window.cxx +++ b/vcl/source/window/window.cxx @@ -9083,11 +9083,18 @@ Window* Window::GetAccessibleRelationLabeledBy() const if (mpWindowImpl->mpAccessibleInfos && mpWindowImpl->mpAccessibleInfos->pLabeledByWindow) return mpWindowImpl->mpAccessibleInfos->pLabeledByWindow; - std::vector<FixedText*> m_aMnemonicLabels(list_mnemonic_labels()); - if (!m_aMnemonicLabels.empty()) + std::vector<FixedText*> aMnemonicLabels(list_mnemonic_labels()); + if (!aMnemonicLabels.empty()) { - SAL_WARN_IF(m_aMnemonicLabels.size() != 1, "vcl.a11y", "TODO: multiple LabeledBy not handled yet"); - return m_aMnemonicLabels[0]; + //if we have multiple labels, then prefer the first that is visible + for (std::vector<FixedText*>::iterator + aI = aMnemonicLabels.begin(), aEnd = aMnemonicLabels.end(); aI != aEnd; ++aI) + { + Window *pCandidate = *aI; + if (pCandidate->IsVisible()) + return pCandidate; + } + return aMnemonicLabels[0]; } if (!isContainerWindow(this) && !isContainerWindow(GetParent())) |