• Post Reply Bookmark Topic Watch Topic
  • New Topic

Newbie: How to add new attribute into "input" element  RSS feed

 
Roman Tarasov
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello!

I'm new with JSF. So need your help!

What I trying to do:

I need a new attribute in "input" element, like <input id = "ssn" type="text" aria-describedby="ssnHelp"/>. The new attribute is "aria-describedby".

The questions are:
1. What is the best way to achieve that? (create new UI component extending HtmlInputText and new tag? how is better to extend it?)
2. Is it possible somehow to solve this problem with <f:attribute>? If yes then how?

Any links or code sample is highly appreciated.

Thanks in advance!
 
Wouter Oet
Bartender
Posts: 2700
IntelliJ IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
First of all welcome to the JavaRanch.

Could you tell us why you want that. Because no browser will be able to parse/use it.
 
Roman Tarasov
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello, thanks!

The main purpose is to make the pages accesible to people with disabilities according to w3c standards. http://www.w3.org/TR/wai-aria/

Regards,

Roman
 
Tim Holloway
Bartender
Posts: 18531
61
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Typically turgid w3c docs.

If I'm reading this correctly, wai-aria isn't HTML. It's an HTML-like widget framework and it does most of its magic by using its own custom attributes which are not valid according to the strict HTML DTDs.

The problem is, JSF is also a widget framework, and it does render strict HTML. So no ad-lib attributes or elements.

Traditional HTML has its own accessibility features, such as the "title" attribute. Obviously the wai-aria people thought that wasn't good enough.

Fair dinkum. But that means that you should be providing wai-aria renderers to replace the default HTML renderers and you'd need to subclass the definitions of any JSF elements where you needed to explicitly provide extension attributes.

JSF was designed for that, but it's not for the faint of heart. Don't just do it because it sounds good, since it's a lot of work. If you're just interested in basic accessibility, exhaust the potential of basic HTML before making such a big jump.

If you do have a compelling reason for wai-aria and JSF, consider making it an open-source project. I'm sure others would like to benefit (and hopefully help!).
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!