Feature #93963

Form extension templates block additionalAttributes

Added by Lennart Suwe about 1 year ago. Updated about 1 year ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Form Framework
Target version:
Start date:
2021-04-21
Due date:
% Done:

0%

Estimated time:
PHP Version:
Tags:
Form Fluid additionalAttributes accessibility
Complexity:
Sprint Focus:

Description

To be able to create Forms with a high accessibility standard, attributes like the following should be able to be used on input fields.

aria-describedby="error-text-id" aria-invalid="true”

Because these attributes don’t seem to be implemented by default, the only way to implement them is through the f:form.textfield ViewHelper with additionalAttributes. But that is not possible. additionalAttributes is already occupied by the following line and cant be appended:

additionalAttributes="{formvh:translateElementProperty(element: element, property: 'fluidAdditionalAttributes')}"

With the current Setup it is not possible to build a accessible Form with modern standards.

#1

Updated by Oliver Bartsch about 1 year ago

  • Status changed from New to Needs Feedback

Hi, thanks for the report. This does not only affect the form framework but basically all "tag-based" ViewHelpers.

I therefore created an issue https://github.com/TYPO3/Fluid/issues/534 and the corresponding PR https://github.com/TYPO3/Fluid/pull/535 in the Fluid framework.

Could you please have a look if this would fix your problem?

#2

Updated by Lennart Suwe about 1 year ago

Yes, that solution would fix the problem.

That wouldn't allow for other non-aria attributes. But aria attributes are the reason I opened this Issue.

#3

Updated by Lennart Suwe about 1 year ago

One thing is still unresolved. The f:form.textfield ViewHelper does not support the autocomplete attribute. But that is a Feature that can't be implemented by the Fluid framework.

Thanks for the fast Reply and Pull Request. I didn't expected this kind of involvement :)

#4

Updated by Oliver Bartsch about 1 year ago

Great, will update you once the feature is merged.

Regarding the autocomplete attribute. As you arealy mentioned, all those Templates set the additionalAttributes argument in the ViewHelper.

additionalAttributes="{formvh:translateElementProperty(element: element, property: 'fluidAdditionalAttributes')}" 

Using fluidAdditionalAttributes you can still pass arbitrary additional attributes, like autocomplete. This has to be done in the corresponding form configuration. This is IMO a way better solution, since you don't have to alter the templates directly.

Please see this example configuration:

type: Form
prototypeName: standard
identifier: some-form
label: Form with custom fluid attributes
renderables:
  -
    type: Page
    identifier: page-1
    label: Step
    renderables:
      -
        type: Text
        identifier: email
        label: Email address
        properties:
          fluidAdditionalAttributes:
            autocomplete: email

#5

Updated by Oliver Bartsch about 1 year ago

  • Status changed from Needs Feedback to Closed

Hi Lennart, just a short update. The Feature was merged into Fluid, see https://github.com/TYPO3/Fluid/pull/536.

I would therefore close this issue now.

Regarding the other additional attributes, as mentioned above, they can be added to a field in the form configuration. In case this is not working for you, please feel free to contact me directly via slack (@oli) or just create a new issue with steps to reproduce it.

Also available in: Atom PDF