Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HTML link element rendered attribute is not applied if no identifying attributes exist #1790

Open
codylerum opened this issue Feb 10, 2023 · 1 comment

Comments

@codylerum
Copy link

The following works fine in JSF 2.3

<div jsf:rendered="#{false}">div NOT rendered</diiv>

<div jsf:rendered="#{true}">div IS rendered</diiv>

<p jsf:rendered="#{false}">p NOT rendered</diiv>

<p jsf:rendered="#{true}">p IS rendered</diiv>

<button type="button" jsf:rendered="#{false}">button NOT rendered</button>

<button type="button" jsf:rendered="#{true}">button is RENDERED</button>

However if the element is an <a> then the jsf:rendered is not applied if the element does not have something like an jsf:outcome or jsf:action for example:

<a href="http://www.google.com" jsf:rendered="#{false}" target="_blank">Renders</a>

<a jsf:outcome="foo" href="http://www.google.com" jsf:rendered="#{false}" target="_blank">Does not render</a>

Expected behavior

Would expect that the jsf:rendered attribute is applied to any html element. It appears that the <a> element is being treated differently.

eclipse-ee4j/mojarra#5212 was opened on this and it was determined that is is because the <a> could be handled by multiple components (h:link, h:commandButton, etc) and since there is no identifying attribute (jsf:action or jsf:outcome for example).

I would propose that if no identifying attribute is found then it should be treated like any other html element (like a div) and the jsf:rendered should still be considered. Otherwise this is confusing and can lead to elements being rendered to the user unexpectedly.

@codylerum codylerum changed the title HTML link element rendered attribute is not applied if no identifying attributes HTML link element rendered attribute is not applied if no identifying attributes exist Feb 10, 2023
@BalusC
Copy link
Member

BalusC commented Jul 22, 2023

+1

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

No branches or pull requests

2 participants