Issue #3223332 by mherchel, Gauravmahlawat, imalabya, andrewmacpherson: Olivero primary search button should be initialized with aria-expanded="false" by JS
parent
d51a1dbbbe
commit
c96121dac0
|
@ -29,9 +29,12 @@ module.exports = {
|
||||||
browser
|
browser
|
||||||
.resizeWindow(1400, 800)
|
.resizeWindow(1400, 800)
|
||||||
.drupalRelativeURL('/')
|
.drupalRelativeURL('/')
|
||||||
|
.waitForElementVisible(searchButtonSelector)
|
||||||
|
.assert.attributeEquals(searchButtonSelector, 'aria-expanded', 'false')
|
||||||
.click(searchButtonSelector)
|
.click(searchButtonSelector)
|
||||||
.waitForElementVisible(`${searchWideSelector}`)
|
.waitForElementVisible(`${searchWideSelector}`)
|
||||||
.waitForElementVisible(`${searchWideSelector} ${searchFormSelector}`)
|
.waitForElementVisible(`${searchWideSelector} ${searchFormSelector}`)
|
||||||
|
.assert.attributeEquals(searchButtonSelector, 'aria-expanded', 'true')
|
||||||
.assert.attributeContains(
|
.assert.attributeContains(
|
||||||
`${searchWideSelector} ${searchFormSelector} input[name=keys]`,
|
`${searchWideSelector} ${searchFormSelector} input[name=keys]`,
|
||||||
'placeholder',
|
'placeholder',
|
||||||
|
@ -42,7 +45,10 @@ module.exports = {
|
||||||
'title',
|
'title',
|
||||||
'Enter the terms you wish to search for.',
|
'Enter the terms you wish to search for.',
|
||||||
)
|
)
|
||||||
.assert.elementPresent('button.search-form__submit');
|
.assert.elementPresent('button.search-form__submit')
|
||||||
|
.click('body')
|
||||||
|
.waitForElementNotVisible(`${searchWideSelector}`)
|
||||||
|
.assert.attributeEquals(searchButtonSelector, 'aria-expanded', 'false');
|
||||||
},
|
},
|
||||||
'search narrow form is accessible': (browser) => {
|
'search narrow form is accessible': (browser) => {
|
||||||
browser
|
browser
|
||||||
|
|
|
@ -77,4 +77,25 @@
|
||||||
toggleSearchVisibility(false);
|
toggleSearchVisibility(false);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initializes the search wide button.
|
||||||
|
*
|
||||||
|
* @type {Drupal~behavior}
|
||||||
|
*
|
||||||
|
* @prop {Drupal~behaviorAttach} attach
|
||||||
|
* Adds aria-expanded attribute to the search wide button.
|
||||||
|
*/
|
||||||
|
Drupal.behaviors.searchWide = {
|
||||||
|
attach(context) {
|
||||||
|
const searchWideButton = once(
|
||||||
|
'search-wide',
|
||||||
|
'[data-drupal-selector="block-search-wide-button"]',
|
||||||
|
context,
|
||||||
|
).shift();
|
||||||
|
if (searchWideButton) {
|
||||||
|
searchWideButton.setAttribute('aria-expanded', 'false');
|
||||||
|
}
|
||||||
|
},
|
||||||
|
};
|
||||||
})(Drupal);
|
})(Drupal);
|
||||||
|
|
|
@ -50,4 +50,13 @@
|
||||||
toggleSearchVisibility(false);
|
toggleSearchVisibility(false);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Drupal.behaviors.searchWide = {
|
||||||
|
attach: function attach(context) {
|
||||||
|
var searchWideButton = once('search-wide', '[data-drupal-selector="block-search-wide-button"]', context).shift();
|
||||||
|
|
||||||
|
if (searchWideButton) {
|
||||||
|
searchWideButton.setAttribute('aria-expanded', 'false');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
})(Drupal);
|
})(Drupal);
|
Loading…
Reference in New Issue