You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@flex.apache.org by Tigran Najaryan <ti...@gmail.com> on 2013/04/15 11:25:04 UTC

[FalconJS] populating the 'id' property at runtime

I am trying to understand how to make sure the 'id' property is available on
the DOM elements.

It looks like if I simply modify function
org.apache.flex.core.UIBase.prototype.set_id() to directly assign the
'value' to this.element.id it works, the id property becomes available at
runtime and is shown by Firebug. 

Is there a reason why set_id() currently does not do it? If this
modification is acceptable I will submit a patch.

Tigran.


Re: [FalconJS] populating the 'id' property at runtime

Posted by Erik de Bruin <er...@ixsoftware.nl>.
I can't think of no other reason than "it wasn't needed". Unless
somehow having an id attribute would mess with JS calls to the object
that has the element... But since all JS objects exist in separate
namespaces, I don't think it should matter.

How about you submit a patch, I create a new public branch (ha, look
at me thinking all "gitty" ;-)) and you work with that branch?

EdB



On Mon, Apr 15, 2013 at 11:25 AM, Tigran Najaryan <ti...@gmail.com> wrote:
> I am trying to understand how to make sure the 'id' property is available on
> the DOM elements.
>
> It looks like if I simply modify function
> org.apache.flex.core.UIBase.prototype.set_id() to directly assign the
> 'value' to this.element.id it works, the id property becomes available at
> runtime and is shown by Firebug.
>
> Is there a reason why set_id() currently does not do it? If this
> modification is acceptable I will submit a patch.
>
> Tigran.
>



-- 
Ix Multimedia Software

Jan Luykenstraat 27
3521 VB Utrecht

T. 06-51952295
I. www.ixsoftware.nl

RE: [FalconJS] populating the 'id' property at runtime

Posted by Tigran Najaryan <ti...@gmail.com>.
> From: Alex Harui [mailto:aharui@adobe.com]
> 
> And since we still need a way for folks to set the id in order to get
> accessibility to work, it might be best for now to just gamble and wire
> up
> set_id to the id.  No need for a branch.  Just do it.   I'll try to get
> someone to think about the accessibility issues.
OK, I will post the patch to Jira (it is actually just a single line of
code) when I reach my work PC.

Tigran.



RE: [FalconJS] populating the 'id' property at runtime

Posted by Tigran Najaryan <ti...@gmail.com>.
> > As an alternative to using the browser's native id attribute (in
> cases
> > where that might be a problem) you can use a data attribute: <input
> > data-flex-id="myid">
> 
> That sounds like the proper way to do this, if RIATest can run on that
> type of attributes.
Yes, RIATest can run on any public attribute. It is just that the id
attribute is used by default and results in a bit cleaner script syntax. It
also useful during recording, and is shown in the object inspector view.
However data-flex-id attribute is also fully usable. We can probably even
teach RIATest to use it by default for all DOM elements which are generated
by FlexJS. 

Similarly for the automationName property (which is currently a standard
property for mx.core.UIComponent) would be best to populate it into
data-automation-name DOM attribute.

Tigran.


Re: [FalconJS] populating the 'id' property at runtime

Posted by Alex Harui <ah...@adobe.com>.


On 4/15/13 7:45 AM, "Erik de Bruin" <er...@ixsoftware.nl> wrote:

>> As an alternative to using the browser's native id attribute (in cases where
>> that might be a problem) you can use a data attribute: <input
>> data-flex-id="myid">
> 
> That sounds like the proper way to do this, if RIATest can run on that
> type of attributes.
> 
> I didn't check, but doesn't the compiler on the Flash side mind if you
> try to use the same id twice?
Yes, but only with in an MXML file.  I think Kevin is pointing out a
potential issue where you have several MXML files of which more than one
uses the same ID.

That's the main reason I didn't wire set_id to the DOM's id:  I wasn't sure
of the implications.  I also was trying to find time to re-read the Web
Components/Shadow DOM proposals to understand how id's work there.

But realistically, anyone with multiple MXML files trying to make an
accessible HTML will probably have to come up with their own scheme to make
sure id's are unique within their app.

And since we still need a way for folks to set the id in order to get
accessibility to work, it might be best for now to just gamble and wire up
set_id to the id.  No need for a branch.  Just do it.   I'll try to get
someone to think about the accessibility issues.

-- 
Alex Harui
Flex SDK Team
Adobe Systems, Inc.
http://blogs.adobe.com/aharui


Re: [FalconJS] populating the 'id' property at runtime

Posted by Erik de Bruin <er...@ixsoftware.nl>.
> As an alternative to using the browser's native id attribute (in cases where
> that might be a problem) you can use a data attribute: <input
> data-flex-id="myid">

That sounds like the proper way to do this, if RIATest can run on that
type of attributes.

I didn't check, but doesn't the compiler on the Flash side mind if you
try to use the same id twice?

EdB



--
Ix Multimedia Software

Jan Luykenstraat 27
3521 VB Utrecht

T. 06-51952295
I. www.ixsoftware.nl

Re: [FalconJS] populating the 'id' property at runtime

Posted by Kevin Newman <Ca...@unFocus.com>.
There are issues with the id of elements in HTML being unique. If they 
are not unique, they seem to have a negative affect on screen readers. I 
don't know if that would be a reason to disabled that, but it's 
something to know.

It's for this reason (and the fact that document.getElementById only 
returns one element, not a collection even if there are more than one 
elements with the same id) that ASP.NET messes with all of your ids in a 
control (which ends up being extremely annoying down stream).

As an alternative to using the browser's native id attribute (in cases 
where that might be a problem) you can use a data attribute: <input 
data-flex-id="myid">

Kevin N.


On 4/15/13 5:25 AM, Tigran Najaryan wrote:
> I am trying to understand how to make sure the 'id' property is available on
> the DOM elements.
>
> It looks like if I simply modify function
> org.apache.flex.core.UIBase.prototype.set_id() to directly assign the
> 'value' to this.element.id it works, the id property becomes available at
> runtime and is shown by Firebug.
>
> Is there a reason why set_id() currently does not do it? If this
> modification is acceptable I will submit a patch.
>
> Tigran.
>