henningn commented on code in PR #7526:
URL: https://github.com/apache/myfaces-tobago/pull/7526#discussion_r3782162098
##########
tobago-core/src/test/resources/renderer/date/error-message.html:
##########
@@ -20,4 +20,4 @@
<div class='input-group'>
<input type='date' name='id' id='id::field' title='a test' max='9999-12-31'
class='is-error form-control' autofocus='autofocus'></div>
<tobago-popover label='Error' value='a test' trigger='focus'>
-<a tabindex='0' role='button' class='btn btn-danger'><i
class='bi-exclamation-lg'></i></a></tobago-popover></div></tobago-date>
+<a tabindex='0' role='button' aria-label='Show a test message' class='btn
btn-danger'><i
class='bi-exclamation-lg'></i></a></tobago-popover></div></tobago-date>
Review Comment:
The aria-label should be "Show error message".
##########
tobago-core/src/main/resources/org/apache/myfaces/tobago/context/TobagoResourceBundle_de.properties:
##########
@@ -41,6 +41,10 @@ sheet.prev=vorherige Seite
sheet.sorting=nach dieser Spalte sortieren
sheet.toPage=Seite {0}
help.title=Hilfe
+help.ariaLabel=Zeige weitere Informationen f�r {0}
+help.ariaLabel.fallback= Zeige weitere Informationen
Review Comment:
Leading space character
##########
tobago-core/src/test/resources/renderer/in/error-message.html:
##########
@@ -20,4 +20,4 @@
<div class='tobago-messages-container tobago-button-right'
data-tobago-faces-message='a test'>
<input type='text' name='id' id='id::field' title='a test' class='is-error
form-control' autofocus='autofocus'>
<tobago-popover label='Error' value='a test' trigger='focus'>
-<a tabindex='0' role='button' class='btn btn-danger'><i
class='bi-exclamation-lg'></i></a></tobago-popover></div></tobago-in>
+<a tabindex='0' role='button' aria-label='Show a test message for label'
class='btn btn-danger'><i
class='bi-exclamation-lg'></i></a></tobago-popover></div></tobago-in>
Review Comment:
The aria-label should be "Show error message".
##########
tobago-core/src/test/resources/renderer/selectBooleanCheckbox/selectBooleanCheckboxFatal.html:
##########
@@ -21,4 +21,4 @@
<input class='form-check-input is-error' type='checkbox' value='true'
name='id' id='id::field' autofocus='autofocus'>
<label class='form-check-label' for='id::field'></label></div>
<tobago-popover label='Fatal' value='This is a custom fatal error'
trigger='focus'>
-<a tabindex='0' role='button' class='btn btn-danger'><i
class='bi-exclamation-lg'></i></a></tobago-popover></div></tobago-select-boolean-checkbox>
+<a tabindex='0' role='button' aria-label='Show This is a custom fatal error
message' class='btn btn-danger'><i
class='bi-exclamation-lg'></i></a></tobago-popover></div></tobago-select-boolean-checkbox>
Review Comment:
The aria-label should be "Show fatal error message".
##########
tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/DecorationPositionRendererBase.java:
##########
@@ -283,15 +282,26 @@ private String getMessage(final List<FacesMessage>
messages) {
}
private void encodeFacesMessagePopover(
- final FacesContext facesContext, final TobagoResponseWriter writer,
final FacesMessage.Severity severity,
+ final FacesContext facesContext, final T component, final
TobagoResponseWriter writer, final FacesMessage.Severity severity,
final List<FacesMessage> messages, final Integer tabIndex) throws
IOException {
final CssItem buttonColor = BootstrapClass.buttonColor(severity);
final String title = getTitle(facesContext, messages);
final String message = getMessage(messages);
- final PopoverTriggers trigger = PopoverTriggers.parse("focus");
+ final String ariaLabel;
+ final String label = ComponentUtils.getStringAttribute(component,
Attributes.label);
- encodePopover(writer, buttonColor, Icons.EXCLAMATION_LG, title, message,
trigger, tabIndex);
+ if (!StringUtils.isEmpty(label)){
+ final Locale locale = facesContext.getViewRoot().getLocale();
+ final MessageFormat ariaLabelFormat = new
MessageFormat(ResourceUtils.getString(facesContext, "message.ariaLabel"),
locale);
+ ariaLabel = ariaLabelFormat.format(new Object[]{message, label});
+ } else {
+ final Locale locale = facesContext.getViewRoot().getLocale();
+ final MessageFormat ariaLabelFormat = new
MessageFormat(ResourceUtils.getString(facesContext,
"message.ariaLabel.fallback"), locale);
+ ariaLabel = ariaLabelFormat.format(new Object[]{message});
Review Comment:
This is two times almost the same code. This could be probably an additional
method.
##########
tobago-core/src/main/resources/org/apache/myfaces/tobago/context/TobagoResourceBundle_es.properties:
##########
@@ -42,6 +42,10 @@ sheet.prev=P\u00E1gina Anterior
sheet.sorting=Ordenar por esta columna
sheet.toPage=P\u00E1gina {0}
help.title=Ayudar
+help.ariaLabel=Mostrar informaci adicional para {0}
Review Comment:
It's not "informaci" but "información". Use unicode.
ó is \u00F3
##########
tobago-core/src/test/resources/renderer/selectBooleanCheckbox/selectBooleanCheckboxError.html:
##########
@@ -21,4 +21,4 @@
<input class='form-check-input is-error' type='checkbox' value='true'
name='id' id='id::field' autofocus='autofocus'>
<label class='form-check-label' for='id::field'></label></div>
<tobago-popover label='Error' value='This is a custom error' trigger='focus'>
-<a tabindex='0' role='button' class='btn btn-danger'><i
class='bi-exclamation-lg'></i></a></tobago-popover></div></tobago-select-boolean-checkbox>
+<a tabindex='0' role='button' aria-label='Show This is a custom error message'
class='btn btn-danger'><i
class='bi-exclamation-lg'></i></a></tobago-popover></div></tobago-select-boolean-checkbox>
Review Comment:
The aria-label should be "Show error message".
##########
tobago-core/src/test/resources/renderer/selectBooleanCheckbox/selectBooleanCheckboxInfo.html:
##########
@@ -21,4 +21,4 @@
<input class='form-check-input is-info' type='checkbox' value='true' name='id'
id='id::field' autofocus='autofocus'>
<label class='form-check-label' for='id::field'></label></div>
<tobago-popover label='Information' value='This is a custom information'
trigger='focus'>
-<a tabindex='0' role='button' class='btn btn-info'><i
class='bi-exclamation-lg'></i></a></tobago-popover></div></tobago-select-boolean-checkbox>
+<a tabindex='0' role='button' aria-label='Show This is a custom information
message' class='btn btn-info'><i
class='bi-exclamation-lg'></i></a></tobago-popover></div></tobago-select-boolean-checkbox>
Review Comment:
The aria-label should be "Show information message".
##########
tobago-core/src/test/resources/renderer/selectManyCheckbox/selectManyCheckboxFatal.html:
##########
@@ -25,4 +25,4 @@
<input class='form-check-input is-error' type='checkbox' name='id' id='id::1'
value=''>
<label class='form-check-label' for='id::1'>Entry Two</label></div></div>
<tobago-popover label='Fatal' value='This is a custom fatal error'
trigger='focus'>
-<a tabindex='0' role='button' class='btn btn-danger'><i
class='bi-exclamation-lg'></i></a></tobago-popover></div></tobago-select-many-checkbox>
+<a tabindex='0' role='button' aria-label='Show This is a custom fatal error
message' class='btn btn-danger'><i
class='bi-exclamation-lg'></i></a></tobago-popover></div></tobago-select-many-checkbox>
Review Comment:
The aria-label should be "Show fatal error message".
##########
tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/DecorationPositionRendererBase.java:
##########
@@ -115,7 +114,7 @@ public void encodeBeginMessageField(final FacesContext
facesContext, final T com
switch (messagePosition) {
case buttonLeft:
- encodeFacesMessagePopover(facesContext, writer, severity, messages,
tabIndex);
+ encodeFacesMessagePopover(facesContext,component, writer, severity,
messages, tabIndex);
Review Comment:
Please use the formatter.
##########
tobago-core/src/test/resources/renderer/selectManyShuttle/error-message.html:
##########
@@ -32,4 +32,4 @@
<div class='tobago-selected-container'>
<select id='id::selected' data-tobago-order='[]' class='tobago-selected
is-error form-select' multiple='multiple' size='2'></select></div></div>
<tobago-popover label='Error' value='a test' trigger='focus'>
-<a tabindex='0' role='button' class='btn btn-danger'><i
class='bi-exclamation-lg'></i></a></tobago-popover></div></tobago-select-many-shuttle>
+<a tabindex='0' role='button' aria-label='Show a test message' class='btn
btn-danger'><i
class='bi-exclamation-lg'></i></a></tobago-popover></div></tobago-select-many-shuttle>
Review Comment:
The aria-label should be "Show error message".
##########
tobago-core/src/test/resources/renderer/selectBooleanCheckbox/selectBooleanCheckboxWarning.html:
##########
@@ -21,4 +21,4 @@
<input class='form-check-input is-warning' type='checkbox' value='true'
name='id' id='id::field' autofocus='autofocus'>
<label class='form-check-label' for='id::field'></label></div>
<tobago-popover label='Warning' value='This is a custom warning'
trigger='focus'>
-<a tabindex='0' role='button' class='btn btn-warning'><i
class='bi-exclamation-lg'></i></a></tobago-popover></div></tobago-select-boolean-checkbox>
+<a tabindex='0' role='button' aria-label='Show This is a custom warning
message' class='btn btn-warning'><i
class='bi-exclamation-lg'></i></a></tobago-popover></div></tobago-select-boolean-checkbox>
Review Comment:
The aria-label should be "Show warning message".
##########
tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/DecorationPositionRendererBase.java:
##########
@@ -48,8 +44,11 @@
import jakarta.faces.application.FacesMessage;
import jakarta.faces.component.UIComponent;
import jakarta.faces.context.FacesContext;
+import javax.print.attribute.standard.Severity;
Review Comment:
Unused import
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]