-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Setting containerTagName to null won't clear the container #761
Comments
What should the functionality be? Other option remove pDOM content when set back to
Marking for dev meeting. |
I like option 2. We have this assertion in insertContentElement: assert && assert( accessiblePeer.containerParent, 'Cannot add sibling if there is no container element' ); Which will error if you do this: b.tagName = 'button';
b.labelTagName = 'p';
b.containerTagName = null; But not if you do this: b.containerTagName = null;
b.tagName = 'button';
b.labelTagName = 'p'; Also, this won't error: var b = new Node( {
tagName: 'button',
labelTagName: 'p',
containerTagName: null
} ); because |
Hmm, from #761 (comment), b.containerTagName = null;
b.tagName = 'button';
b.labelTagName = 'p'; is perfectly valid if default value for containerTagName is null. So I am not sure yet what the best option is. |
I don't know what the word "valid" means here. Yes the above works, but the containerTagName is still added. This is because the labelTagName call adds in a parent automatically if conatiner is null. Both of the following code snippets yield the same HTML. Please confirm and play in the playground.
var b = new Node( {
tagName: 'button',
labelTagName: 'p',
containerTagName: null
} ); <div class="accessibility">
<div tabindex="-1" id="container-2-11">
<p tabindex="-1" id="label-2-11"></p>
<button id="2-11" tabindex="0"></button>
</div>
</div> |
Sorry, I was trying to say that they are effectively no-ops because the default value for |
I worry about it seeming clever and confusing. Here, an explicit call to nullify a tagName doesn't change the pDOM at all. Maybe it will be good to describe this behavior in the |
I agree it is a problem and think documentation may be the best way to go. What if we assert that |
What about: var b = new Node( {
tagName: 'button',
labelTagName: 'p',
} );
b.labelTagName = null;
console.log( b.containerTagName); // ---> 'DIV'
b.containerTagName = null;
console.log( b.containerTagName); // ---> null Confirmed in playground. It seems like right now, it would be important to be able to clear that container after clearing the label. It is a bummer that you have to "cleanup" the container after you didn't even set it. |
Totally agree.
Do you think it is worth throwing an error rather than creating a a default parent DOMElement when adding label/description siblings, so client always has to add the container? EDIT: for clarity |
No I don't think this is worth it. I think that makes things much more annoying to use, and that it isn't worth it to have to add this to every place where a sibling is declared (sorta like trading one gotcha for another). Let's go down the documentation route, as devs will be looking at the doc for sibling/parent setters a lot as they learn how it works. We can get feedback from them as we go. |
OK, that sounds great to me. |
Alright, @jessegreenberg please review and close if that's all (commit coming when my computer wakes up). |
Good find! THanks. |
This happens when there are other siblings than just the primary sibling, basically because the default kicks in too strong. I want to discuss the desired functionality before diving in.
The text was updated successfully, but these errors were encountered: