[js-embedded-discovery] branch main updated: EDS-68 Allow using Tab key to cycle through typeahead entries
Rod Widdowson
rdw at steadingsoftware.com
Sun Aug 24 13:27:15 UTC 2025
This is an automated email from the git hooks/post-receive script.
rdw pushed a commit to branch main
in repository js-embedded-discovery.
View the commit online:
http://git.shibboleth.net/view/?p=js-embedded-discovery.git;a=commit;h=99ef9ec6a4dad847d2074573dc53b11a67f64219
The following commit(s) were added to refs/heads/main by this push:
new 99ef9ec EDS-68 Allow using Tab key to cycle through typeahead entries
99ef9ec is described below
commit 99ef9ec6a4dad847d2074573dc53b11a67f64219
Author: Rod Widdowson <rdw at steadingsoftware.com>
AuthorDate: Sun Aug 24 14:24:31 2025 +0100
EDS-68 Allow using Tab key to cycle through typeahead entries
This reverts commit 2dad37c0f0d918783056af18658fa7c74fa71cbd.
Testing by people using screen readers has raised significant
accessibility concerns.
---
src/javascript/typeahead.js | 54 ++++++++++-----------------------------------
1 file changed, 12 insertions(+), 42 deletions(-)
diff --git a/src/javascript/typeahead.js b/src/javascript/typeahead.js
index 66a6fb7..4b1555e 100644
--- a/src/javascript/typeahead.js
+++ b/src/javascript/typeahead.js
@@ -189,27 +189,6 @@ TypeAheadControl.prototype.handleKeyDown = function(event) {
// down arrow
//
this.downSelect();
- } else if (9 == key) {
- //
- // tab key
- //
- if (event.shiftKey) {
- // Cycle back to bottom, set current past end of list
- if (this.dropDown.current === 0) {
- this.dropDown.childNodes[this.dropDown.current].className = '';
- this.dropDown.current = -1;
- }
- this.upSelect();
- event.preventDefault();
- } else {
- // Cycle back to top, set current before start of list
- if (this.dropDown.current === (this.results.length-1)) {
- this.dropDown.childNodes[this.dropDown.current].className = '';
- this.dropDown.current = -1;
- }
- this.downSelect();
- event.preventDefault();
- }
}
};
@@ -384,24 +363,20 @@ TypeAheadControl.prototype.select = function(selected) {
this.textBox.focus();
};
-TypeAheadControl.prototype.mimicSelect = function(index) {
- //
- // mimic a select()
- //
- this.dropDown.current = index;
- this.dropDown.childNodes[index].className = 'IdPSelectCurrent';
- this.dropDown.childNodes[index].setAttribute('aria-selected', 'true');
- this.textBox.setAttribute('aria-activedescendant', 'IdPSelectOption' + index);
- this.doSelected();
- this.origin.value = this.results[index][1];
- this.origin.textValue = this.results[index][0];
-};
-
TypeAheadControl.prototype.downSelect = function() {
if (this.results.length > 0) {
if (-1 == this.dropDown.current) {
- this.mimicSelect(0);
+ //
+ // mimic a select()
+ //
+ this.dropDown.current = 0;
+ this.dropDown.childNodes[0].className = 'IdPSelectCurrent';
+ this.dropDown.childNodes[0].setAttribute('aria-selected', 'true');
+ this.textBox.setAttribute('aria-activedescendant', 'IdPSelectOption' + 0);
+ this.doSelected();
+ this.origin.value = this.results[0][1];
+ this.origin.textValue = this.results[0][0];
} else if (this.dropDown.current < (this.results.length-1)) {
//
@@ -428,12 +403,8 @@ TypeAheadControl.prototype.downSelect = function() {
TypeAheadControl.prototype.upSelect = function() {
- if (this.results.length > 0) {
-
- if (-1 == this.dropDown.current) {
- this.mimicSelect(this.results.length-1);
-
- } else if (this.dropDown.current > 0) {
+ if ((this.results.length > 0) &&
+ (this.dropDown.current > 0)) {
//
// turn off highlight
@@ -453,5 +424,4 @@ TypeAheadControl.prototype.upSelect = function() {
this.origin.value = this.results[this.dropDown.current][1];
this.origin.textValue = this.results[this.dropDown.current][0];
}
- }
};
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the commits
mailing list