Skip to content
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

Combobox: multiple fixes. #674

Closed
wants to merge 11 commits into from
Closed
5 changes: 3 additions & 2 deletions Combobox/ComboPopup.html
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
<template role="presentation"
requires="deliteful/LinearLayout, deliteful/Button">
<d-linear-layout style="height: 100%">
<div class="d-combo-popup-header">{{header}}</div>
<div class="d-combo-popup-header" id="{{_tag}}-{{widgetId}}-header">{{header}}</div>
<input d-hidden="{{this.combobox._inputReadOnly}}"
aria-labelledby="{{_tag}}-{{widgetId}}-header"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: This confused me at first since tests/functional/ComboPopup.js already checks for a label for the input:

var checkListInPopup = function (remote, comboId, hasFilterInput, isMultiSelect) {
...
		.findByCssSelector("label[for='" + comboId + "-input']")
		.getVisibleText()
		.then(function (value) {
			assert.strictEqual(value, label);
			label = null;
		})

It turns out that test is useless though because it's checking the <label> for the <input> in the original Combobox rather than for the <input> in the ComboPopup.

So, I see why you added this. It's unusual to use aria-labelledby rather than <label> though.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PS: Oh, I just realized that it isn't checking the <label> for the <input> in the original Combobox but rather just getting the value, to be used later.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Filed #686.

attach-point="inputNode"
class="d-combobox-input"
role="combobox" autocomplete="off" autocapitalize="none" autocorrect="off"
Expand All @@ -17,4 +18,4 @@
label="{{combobox.okMsg}}" on-click="{{okHandler}}"></button>
</d-linear-layout>
</d-linear-layout>
</template>
</template>
5 changes: 5 additions & 0 deletions Combobox/ComboPopup.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,11 @@ define([
.removeClass("d-hidden");
}
this.combobox._prepareInput(this.inputNode);
this.combobox.observe(function (oldValues) {
if ("opened" in oldValues) {
this.inputNode.setAttribute("aria-expanded", this.combobox.opened);
}
}.bind(this));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm confused, isn't this.combobox.opened always true whenever ComboPopup is shown?

Also (minor thing), the checkin comment since aria-described but the code change is for aria-labelledby.

Copy link
Member

@wkeese wkeese Jan 13, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

aria-expanded should indicate whether or not the list is displayed, which (on the master branch) is controlled by Combobox#_togglePopupList(), or you can get the info from this.combobox.list.getAttribute("d-shown").

Usually the list is displayed, but sometimes it isn't, like the second to last test case in ComboPopup.html where hasDownArrow=false minFilterChars=3. The list is only displayed after typing 3 characters.

PS: Perhaps ComboPopup should have a displayList property, and then Combobox#_togglePopupList() should set that property to true/false.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Filed #687.

}
}
},
Expand Down