Skip to content

Commit ee16859

Browse files
authored
Merge pull request #3476 from Salman-in/fix/word-wrap-toggle-3475
fix: Inconsistent Screen Reader Announcement for Word Wrap Toggle Button in Settings
2 parents 2a15e77 + 589b725 commit ee16859

18 files changed

+66
-68
lines changed

client/modules/IDE/components/Preferences/Preferences.unit.test.jsx

Lines changed: 23 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -442,45 +442,43 @@ describe('<Preferences />', () => {
442442
);
443443
});
444444
});
445+
describe('start wordwrap at false', () => {
446+
it('wordwrap toggle, starting at false', () => {
447+
// render the component with wordwrap prop set to false
448+
subject({ wordwrap: false });
445449

446-
describe('start linewrap at false', () => {
447-
it('linewrap toggle, starting at false', () => {
448-
// render the component with linewrap prop set to false
449-
subject({ linewrap: false });
450-
451-
// get ahold of the radio buttons for toggling linewrap
452-
const linewrapRadioFalse = screen.getByRole('radio', {
453-
name: /linewrap off/i
450+
// get ahold of the radio buttons for toggling wordwrap
451+
const wordwrapRadioFalse = screen.getByRole('radio', {
452+
name: /wordwrap off/i
454453
});
455-
const linewrapRadioTrue = screen.getByRole('radio', {
456-
name: /linewrap on/i
454+
const wordwrapRadioTrue = screen.getByRole('radio', {
455+
name: /wordwrap on/i
457456
});
458457

459458
testToggle(
460-
linewrapRadioFalse,
461-
linewrapRadioTrue,
459+
wordwrapRadioFalse,
460+
wordwrapRadioTrue,
462461
props.setLinewrap,
463462
true
464463
);
465464
});
466465
});
466+
describe('start wordwrap at true', () => {
467+
it('wordwrap toggle, starting at true', () => {
468+
// render the component with wordwrap prop set to true
469+
subject({ wordwrap: true });
467470

468-
describe('start linewrap at true', () => {
469-
it('linewrap toggle, starting at true', () => {
470-
// render the component with linewrap prop set to false
471-
subject({ linewrap: true });
472-
473-
// get ahold of the radio buttons for toggling linewrap
474-
const linewrapRadioFalse = screen.getByRole('radio', {
475-
name: /linewrap off/i
471+
// get ahold of the radio buttons for toggling wordwrap
472+
const wordwrapRadioFalse = screen.getByRole('radio', {
473+
name: /wordwrap off/i
476474
});
477-
const linewrapRadioTrue = screen.getByRole('radio', {
478-
name: /linewrap on/i
475+
const wordwrapRadioTrue = screen.getByRole('radio', {
476+
name: /wordwrap on/i
479477
});
480478

481479
testToggle(
482-
linewrapRadioTrue,
483-
linewrapRadioFalse,
480+
wordwrapRadioTrue,
481+
wordwrapRadioFalse,
484482
props.setLinewrap,
485483
false
486484
);
@@ -513,7 +511,7 @@ describe('<Preferences />', () => {
513511
});
514512

515513
const generalElement1 = screen.getByRole('radio', {
516-
name: /linewrap on/i
514+
name: /wordwrap on/i
517515
});
518516
expect(generalElement1).toBeInTheDocument();
519517
});

client/modules/IDE/components/Preferences/index.jsx

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ export default function Preferences() {
3838
tabIndex,
3939
fontSize,
4040
autosave,
41-
linewrap,
41+
wordwrap,
4242
lineNumbers,
4343
lintWarning,
4444
textOutput,
@@ -386,27 +386,27 @@ export default function Preferences() {
386386
<input
387387
type="radio"
388388
onChange={() => dispatch(setLinewrap(true))}
389-
aria-label={t('Preferences.LineWrapOnARIA')}
390-
name="linewrap"
391-
id="linewrap-on"
389+
aria-label={t('Preferences.WordWrapOnARIA')}
390+
name="wordwrap"
391+
id="wordwrap-on"
392392
className="preference__radio-button"
393393
value="On"
394-
checked={linewrap}
394+
checked={wordwrap}
395395
/>
396-
<label htmlFor="linewrap-on" className="preference__option">
396+
<label htmlFor="wordwrap-on" className="preference__option">
397397
{t('Preferences.On')}
398398
</label>
399399
<input
400400
type="radio"
401401
onChange={() => dispatch(setLinewrap(false))}
402-
aria-label={t('Preferences.LineWrapOffARIA')}
403-
name="linewrap"
404-
id="linewrap-off"
402+
aria-label={t('Preferences.WordWrapOffARIA')}
403+
name="wordwrap"
404+
id="wordwrap-off"
405405
className="preference__radio-button"
406406
value="Off"
407-
checked={!linewrap}
407+
checked={!wordwrap}
408408
/>
409-
<label htmlFor="linewrap-off" className="preference__option">
409+
<label htmlFor="wordwrap-off" className="preference__option">
410410
{t('Preferences.Off')}
411411
</label>
412412
</fieldset>

translations/locales/be/translations.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,8 +168,8 @@
168168
"AutocompleteHinterOnARIA": "অটোকমপ্লিট হিন্টার চালু",
169169
"AutocompleteHinterOffARIA": "অটোকম",
170170
"WordWrap": "শব্দ বিন্যাস",
171-
"LineWrapOnARIA": "লাইন বিন্যাস অন",
172-
"LineWrapOffARIA": "লাইন বিন্যাস অফ",
171+
"WordWrapOnARIA": "লাইন বিন্যাস অন",
172+
"WordWrapOffARIA": "লাইন বিন্যাস অফ",
173173
"LineNumbers": "লাইন সংখ্যা",
174174
"LineNumbersOnARIA": "লাইন সংখ্যা অন",
175175
"LineNumbersOffARIA": "লাইন সংখ্যা অফ",

translations/locales/de/translations.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,8 +159,8 @@
159159
"AutocloseBracketsQuotesOnARIA": "Klammern und Anführungszeichen automatisch schließen an",
160160
"AutocloseBracketsQuotesOffARIA": "Klammern und Anführungszeichen automatisch schließen aus",
161161
"WordWrap": "Wortumbruch",
162-
"LineWrapOnARIA": "zeilenumbruch an",
163-
"LineWrapOffARIA": "zeilenumbruch aus",
162+
"WordWrapOnARIA": "zeilenumbruch an",
163+
"WordWrapOffARIA": "zeilenumbruch aus",
164164
"LineNumbers": "Zeilennummerierung",
165165
"LineNumbersOnARIA": "Zeilennummerierung an",
166166
"LineNumbersOffARIA": "Zeilennummerierung aus",

translations/locales/en-US/translations.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -201,8 +201,8 @@
201201
"AutocompleteHinterOnARIA": "autocomplete hinter on",
202202
"AutocompleteHinterOffARIA": "autocomplete hinter off",
203203
"WordWrap": "Word Wrap",
204-
"LineWrapOnARIA": "linewrap on",
205-
"LineWrapOffARIA": "linewrap off",
204+
"WordWrapOnARIA": "wordwrap on",
205+
"WordWrapOffARIA": "wordwrap off",
206206
"LineNumbers": "Line numbers",
207207
"LineNumbersOnARIA": "line numbers on",
208208
"LineNumbersOffARIA": "line numbers off",

translations/locales/es-419/translations.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,8 +160,8 @@
160160
"Off": "Desactivar",
161161
"AutosaveOffARIA": "Grabado automático desactivado",
162162
"WordWrap": "Ajuste automático de línea",
163-
"LineWrapOnARIA": "Ajuste automático de línea activado",
164-
"LineWrapOffARIA": "Ajuste automático de línea desactivado",
163+
"WordWrapOnARIA": "Ajuste automático de línea activado",
164+
"WordWrapOffARIA": "Ajuste automático de línea desactivado",
165165
"LineNumbers": "Número de línea",
166166
"LineNumbersOnARIA": "Número de línea activado",
167167
"LineNumbersOffARIA": "Número de línea desactivado",

translations/locales/fr-CA/translations.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,8 +160,8 @@
160160
"AutocloseBracketsQuotesOnARIA": "fermeture automatique des crochets et des guillemets activée",
161161
"AutocloseBracketsQuotesOffARIA": "fermeture automatique des crochets et des guillemets désactivée",
162162
"WordWrap": "Retour à la ligne automatique",
163-
"LineWrapOnARIA": "retour à la ligne automatique activé",
164-
"LineWrapOffARIA": "retour à la ligne automatique désactivé",
163+
"WordWrapOnARIA": "retour à la ligne automatique activé",
164+
"WordWrapOffARIA": "retour à la ligne automatique désactivé",
165165
"LineNumbers": "Numéros de lignes",
166166
"LineNumbersOnARIA": "numéros de lignes activés",
167167
"LineNumbersOffARIA": "numéros de lignes désactivés",

translations/locales/hi/translations.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,8 +176,8 @@
176176
"AutocompleteHinterOnARIA": "ऑटोकम्प्लीट हिंटर चालू",
177177
"AutocompleteHinterOffARIA": "ऑटोकम्प्लीट हिंटर बंद",
178178
"WordWrap": "वर्ड रैप",
179-
"LineWrapOnARIA": "लाइनरैप चालू",
180-
"LineWrapOffARIA": "लाइनरैप बंद",
179+
"WordWrapOnARIA": "वर्डरैप चालू",
180+
"WordWrapOffARIA": "वर्डरैप बंद",
181181
"LineNumbers": "लाइन नम्बर्ज़",
182182
"LineNumbersOnARIA": "लाइन नम्बर्ज़ चालू",
183183
"LineNumbersOffARIA": "लाइन नम्बर्ज़ बंद",

translations/locales/it/translations.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,8 +161,8 @@
161161
"AutocloseBracketsQuotesOnARIA": "Auto-chiusura parentesi e virgolette attivo",
162162
"AutocloseBracketsQuotesOffARIA": "Auto-chiusura parentesi e virgolette disabilitata",
163163
"WordWrap": "Dividi parole",
164-
"LineWrapOnARIA": "dividi parole attivo",
165-
"LineWrapOffARIA": "dividi parole disabilitato",
164+
"WordWrapOnARIA": "dividi parole attivo",
165+
"WordWrapOffARIA": "dividi parole disabilitato",
166166
"LineNumbers": "Numero linea",
167167
"LineNumbersOnARIA": "numero linea attivo",
168168
"LineNumbersOffARIA": "numero linea disabilitato",

translations/locales/ja/translations.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,8 +159,8 @@
159159
"AutocloseBracketsQuotesOnARIA": "括弧を自動的に閉じる オン",
160160
"AutocloseBracketsQuotesOffARIA": "括弧を自動的に閉じる オフ",
161161
"WordWrap": "ワードラップ",
162-
"LineWrapOnARIA": "ラインラップ オン",
163-
"LineWrapOffARIA": "ラインラップ オフ",
162+
"WordWrapOnARIA": "ラインラップ オン",
163+
"WordWrapOffARIA": "ラインラップ オフ",
164164
"LineNumbers": "行番号",
165165
"LineNumbersOnARIA": "行番号 表示",
166166
"LineNumbersOffARIA": "行番号 非表示",

translations/locales/ko/translations.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,8 +145,8 @@
145145
"AutocloseBracketsQuotesOnARIA": "괄호 및 따옴표 자동 닫기 켜기",
146146
"AutocloseBracketsQuotesOffARIA": "괄호 및 따옴표 자동 닫기 끄기",
147147
"WordWrap": "단어 자동 줄 바꿈",
148-
"LineWrapOnARIA": "줄 바꿈 켜기",
149-
"LineWrapOffARIA": "줄 바꿈 끄기",
148+
"WordWrapOnARIA": "줄 바꿈 켜기",
149+
"WordWrapOffARIA": "줄 바꿈 끄기",
150150
"LineNumbers": "줄 번호",
151151
"LineNumbersOnARIA": "줄 번호 켜기",
152152
"LineNumbersOffARIA": "줄 번호 끄기",

translations/locales/pt-BR/translations.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,8 +159,8 @@
159159
"AutocloseBracketsQuotesOnARIA": "fechar automaticamente chaves e aspas ativado",
160160
"AutocloseBracketsQuotesOffARIA": "fechar automaticamente chaves e aspas desativado",
161161
"WordWrap": "Ajuste Automático de Linhas",
162-
"LineWrapOnARIA": "ajuste automático de linhas ativado",
163-
"LineWrapOffARIA": "ajuste automático de linhas desativado",
162+
"WordWrapOnARIA": "ajuste automático de linhas ativado",
163+
"WordWrapOffARIA": "ajuste automático de linhas desativado",
164164
"LineNumbers": "Número de linhas",
165165
"LineNumbersOnARIA": "número de linhas ativado",
166166
"LineNumbersOffARIA": "número de linhas desativado",

translations/locales/sv/translations.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,8 +159,8 @@
159159
"AutocloseBracketsQuotesOnARIA": "automatisk stängnging av parenteser och citattecken på",
160160
"AutocloseBracketsQuotesOffARIA": "automatisk stängnging av parenteser och citattecken av",
161161
"WordWrap": "Radbrytning",
162-
"LineWrapOnARIA": "radbrytning på",
163-
"LineWrapOffARIA": "radbrytning av",
162+
"WordWrapOnARIA": "radbrytning på",
163+
"WordWrapOffARIA": "radbrytning av",
164164
"LineNumbers": "Radnummer",
165165
"LineNumbersOnARIA": "radnummer på",
166166
"LineNumbersOffARIA": "radnummer av",

translations/locales/tr/translations.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,8 +161,8 @@
161161
"AutocloseBracketsQuotesOnARIA": "parantez ve tırnakları otomatik kapatma açık",
162162
"AutocloseBracketsQuotesOffARIA": "parantez ve tırnakları otomatik kapatma kapalı",
163163
"WordWrap": "Sözcük Kaydırma",
164-
"LineWrapOnARIA": "satır kaydırma açık",
165-
"LineWrapOffARIA": "satır kaydırma kapalı",
164+
"WordWrapOnARIA": "satır kaydırma açık",
165+
"WordWrapOffARIA": "satır kaydırma kapalı",
166166
"LineNumbers": "Satır Numaraları",
167167
"LineNumbersOnARIA": "satır numaraları açık",
168168
"LineNumbersOffARIA": "satır numaraları kapalı",

translations/locales/uk-UA/translations.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,8 +159,8 @@
159159
"AutocloseBracketsQuotesOnARIA": "автоматично закривати дужки та лапки",
160160
"AutocloseBracketsQuotesOffARIA": "автоматично закривати дужки та лапки",
161161
"WordWrap": "Перенесення слів",
162-
"LineWrapOnARIA": "перенесення рядків увімкнено",
163-
"LineWrapOffARIA": "перенесення рядків вимкнено",
162+
"WordWrapOnARIA": "перенесення рядків увімкнено",
163+
"WordWrapOffARIA": "перенесення рядків вимкнено",
164164
"LineNumbers": "Номери рядків",
165165
"LineNumbersOnARIA": "номери рядків вимкнено",
166166
"LineNumbersOffARIA": "номери рядків вимкнено",

translations/locales/ur/translations.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,8 +159,8 @@
159159
"AutocompleteHinterOnARIA": "خودکار تکمیل اشارہ آن",
160160
"AutocompleteHinterOffARIA": "خود کار طریقے سے اشارہ بند",
161161
"WordWrap": "لفظ لفاف",
162-
"LineWrapOnARIA": "لائن لپیٹنا",
163-
"LineWrapOffARIA": "لائن لپیٹنا",
162+
"WordWrapOnARIA": "لائن لپیٹنا",
163+
"WordWrapOffARIA": "لائن لپیٹنا",
164164
"LineNumbers": "لائن نمبرز",
165165
"LineNumbersOnARIA": "لائن نمبر آن",
166166
"LineNumbersOffARIA": "لائن نمبر بند",

translations/locales/zh-CN/translations.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,8 +162,8 @@
162162
"AutocompleteHinterOnARIA": "打开补全提示",
163163
"AutocompleteHinterOffARIA": "关闭补全提示",
164164
"WordWrap": "自动提行",
165-
"LineWrapOnARIA": "打开自动提行",
166-
"LineWrapOffARIA": "关闭自动提行",
165+
"WordWrapOnARIA": "打开自动提行",
166+
"WordWrapOffARIA": "关闭自动提行",
167167
"LineNumbers": "行号",
168168
"LineNumbersOnARIA": "打开行号",
169169
"LineNumbersOffARIA": "关闭行号",

translations/locales/zh-TW/translations.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,8 +162,8 @@
162162
"AutocompleteHinterOnARIA": "加上補全提示",
163163
"AutocompleteHinterOffARIA": "不加上補全提示",
164164
"WordWrap": "折行",
165-
"LineWrapOnARIA": "啟用自動折行",
166-
"LineWrapOffARIA": "停用自動折行",
165+
"WordWrapOnARIA": "啟用自動折行",
166+
"WordWrapOffARIA": "停用自動折行",
167167
"LineNumbers": "行號",
168168
"LineNumbersOnARIA": "顯示行號",
169169
"LineNumbersOffARIA": "不顯示行號",

0 commit comments

Comments
 (0)