Bug 1791219 - Fix direction of <select>. r=mconley

Differential Revision: https://phabricator.services.mozilla.com/D157576
This commit is contained in:
Emilio Cobos Álvarez 2022-09-21 02:00:13 +00:00
Родитель 5e854cdaff
Коммит 8855a8d3ac
3 изменённых файлов: 25 добавлений и 1 удалений

Просмотреть файл

@ -13,4 +13,5 @@ skip-if =
skip-if = os == "linux" # Bug 1329991 - test fails intermittently on Linux builds
[browser_selectpopup_searchfocus.js]
[browser_selectpopup_width.js]
[browser_selectpopup_dir.js]
[browser_selectpopup_user_input.js]

Просмотреть файл

@ -0,0 +1,23 @@
const PAGE = `
<!doctype html>
<select style="direction: rtl">
<option>ABC</option>
<option>DEFG</option>
</select>
`;
add_task(async function() {
const url = "data:text/html," + encodeURI(PAGE);
await BrowserTestUtils.withNewTab(
{
gBrowser,
url,
},
async function(browser) {
let popupShownPromise = BrowserTestUtils.waitForSelectPopupShown(window);
await BrowserTestUtils.synthesizeMouseAtCenter("select", {}, browser);
let popup = await popupShownPromise;
is(popup.style.direction, "rtl", "Should be the right dir");
}
);
});

Просмотреть файл

@ -113,6 +113,7 @@ var SelectParentHelper = {
menupopup.setAttribute("style", "");
menupopup.style.colorScheme = isDarkBackground ? "dark" : "light";
menupopup.style.direction = selectStyle.direction;
stylesheet = doc.createElementNS("http://www.w3.org/1999/xhtml", "style");
stylesheet.setAttribute("id", "ContentSelectDropdownStylesheet");
@ -781,7 +782,6 @@ class SelectParent extends JSWindowActorParent {
let menulist = this._menulist || this._createMenulist();
let data = message.data;
menulist.menupopup.style.direction = data.style.direction;
SelectParentHelper.populate(
menulist,