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.

Textarea shows both placeholder and aria-placeholder, and thats an issue

See original GitHub issue

Using accessibility-checker we see that there is an issue with textarea - its adding both placeholer and aria-placeholder which is an issue.

As an aside, in my code I do not add placeholder at all

<TextArea
        id='description'
        name='description'
        {...description}
        labelText={t('addSecret.secretForm.description')}
        invalid={!!(descriptionMeta.touched && descriptionMeta.error)}
        invalidText={descriptionMeta.error}
      />

image

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

3reactions
carmacleodcommented, Oct 26, 2020

@dakahn

I think you can just use “or null” to make sure the placeholder is not used if it is not given, i.e.

      placeholder={placeholder || null}
      aria-placeholder={placeholder || null}

Do you need to support IE11? If not, then you don’t need to use aria-placeholder at all, because modern browsers all map the placeholder attribute of HTML textarea to aria-placeholder automatically. (Actually, even in IE11, NVDA reads the placeholder, but JAWS doesn’t.)

The only “modern” reason to use aria-placeholder would be if you decide to switch the implementation to a div contenteditable or something that doesn’t support placeholder… but then you would have a bunch more work to do, so don’t do that. 😃

1reaction
alon24commented, Nov 29, 2020

This is not a fix, it does not fix the issue, it just hides it if its null. The issue is that there is BOTH placeholder and aria-placeholder So are you saying this is ok, and the tester is wrong?

Read more comments on GitHub >

github_iconTop Results From Across the Web

aria-placeholder - Accessibility - MDN Web Docs - Mozilla
A placeholder is text that appears in the form control when it has no value set. The HTML placeholder attribute enables providing a...
Read more >
html - what is the difference between placeholder and aria ...
A placeholder is a text that appears in the form control when it has no value set. The HTML placeholder attribute enables providing...
Read more >
Does Placeholder text AND aria-describedby work on a form ...
I've run across high profile sites that want to do the right thing. They have a form with a proper label, placeholder text...
Read more >
Don't Use The Placeholder Attribute - Smashing Magazine
The placeholder attribute contains a surprising amount of issues that prevent it from delivering on what it promises. Let's clarify why you ...
Read more >
HTML textarea placeholder Attribute - W3Schools
The placeholder attribute specifies a short hint that describes the expected value of a text area. The short hint is displayed in the...
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