question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

SelectOneMenu: accessibility violation

See original GitHub issue

Describe the defect p:selectOneMenu doesn’t follow WAI-ARIA Specs

Environment:

  • PF Version: 6.2.27
  • JSF + version: Mojarra N.D.
  • Affected browsers: ALL

To Reproduce Steps to reproduce the behavior:

  1. Load xhtml page
  2. Primefaces generates incorrect html element

Expected behavior

Every Input with id myid_focus shouldn’t have an aria-expanded attribute

When ARIA attributes are used on HTML elements that are not in accordance with WAI-ARIA 1.1, they conflict with the semantics of the elements which can cause assistive technology products report nonsensical user interface (UI) information that does not represent the actual UI of the document.

https://dequeuniversity.com/rules/axe/3.5/aria-allowed-attr?application=AxeChrome

Example XHTML

<h:form id="frmTest">
    <p:selectOneMenu id="myid" value="#{bean.variable}">
        <f:selectItems value="#{bean.variables}" />
    </p:selectOneMenu>
</h:form>

generates

<form id="frmTest" name="frmTest" method="post" action="/tributi/utente/welcome.xhtml" enctype="application/x-www-form-urlencoded">
	<input type="hidden" name="frmTest" value="frmTest">
	<div id="frmTest:myid" class="ui-selectonemenu ui-widget ui-state-default ui-corner-all ui-state-hover" role="combobox" aria-haspopup="true" aria-expanded="true" aria-owns="frmTest:myid_items" style="min-width: 24px;">
		<div class="ui-helper-hidden-accessible">
			<input id="frmTest:myid_focus" name="frmTest:myid_focus" type="text" autocomplete="off" aria-expanded="true" aria-autocomplete="list" aria-disabled="false">
		</div>
		<div class="ui-helper-hidden-accessible">
			<select id="frmTest:myid_input" name="frmTest:myid_input" tabindex="-1" aria-hidden="true"/>
		</div>
		<label id="frmTest:myid_label" class="ui-selectonemenu-label ui-inputfield ui-corner-all">&nbsp;</label>
		<div class="ui-selectonemenu-trigger ui-state-default ui-corner-right ui-state-hover">
			<span class="ui-icon ui-icon-triangle-1-s ui-c"/>
		</div>
	</div>
	<input type="hidden" name="javax.faces.ViewState" id="j_id1:javax.faces.ViewState:1" value="-856014644197753318:920539168267910855" autocomplete="off">
</form>

Current workaround

<h:form id="frmTest">
    <p:selectOneMenu id="myid" value="#{bean.variable}">
        <f:selectItems value="#{bean.variables}" />
    </p:selectOneMenu>
    <script>
        document.getElementById("frmtest:myid_focus").removeAttribute("aria-expanded");
    </script>
</h:form>

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
tandraschkocommented, Jun 18, 2020

it’s a bit complicated 😄 (I’m not a member of PrimeTek!)

This here is the community issue tracker. Bugs are fixed here in the github master and partly backported to the elite releases from PrimeTek, which are maintained in a private PrimeTek repository. Which issues are packported is the decision by PrimeTek. PRO users can directly influence issues to be packported in elite releases. The current supported versions are 7.0.x and 8.0.x.

So it’s actually a required information for us, the community, to check if its already fixed in trunk.

And yes, please try to upgrade 😃 It contains sooo many improvements.

0reactions
kukelcommented, Jun 23, 2020

sooo is an understatement… soooooooo is better 😉

Read more comments on GitHub >

github_iconTop Results From Across the Web

Accessibility Issue with selectOneMenu and ...
I've encountered an accessibility issue with selectOneMenu and selectCheckboxMenu. The main issue is that the label (which is present in the ...
Read more >
JSF - Validation fails on SelectOneMenu (error is not valid)
Well,. no solution for selectOneMenu. So I used an autoComplete with dropdown (true). It works fine. So, this is not really a solution,...
Read more >
problem with &lt;h:selectOneMenu component --- identifier ...
Hibernate: org.hibernate.AssertionFailure: null id don't flush the Session after an exception occurs. 3 replies. JSF. Classloader violation richfaces3.3 and ...
Read more >
10.2 Adding Components to a Page Using HTML Tag Library ...
The label text is represented by the value attribute. 10.2.8.2 Displaying a Menu Using the h:selectOneMenu Tag. A component that allows the user...
Read more >
A Framework for Enterprise Java - JBoss.org
If the constraints are violated, JSF redisplays the page. Otherwise, JSF binds the ... Seam was designed so that data access code is...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found