summaryrefslogtreecommitdiffstats
path: root/web_src/js/features/user-settings.js
diff options
context:
space:
mode:
Diffstat (limited to 'web_src/js/features/user-settings.js')
-rw-r--r--web_src/js/features/user-settings.js5
1 files changed, 5 insertions, 0 deletions
diff --git a/web_src/js/features/user-settings.js b/web_src/js/features/user-settings.js
index 8f68b03b29..111bfc4465 100644
--- a/web_src/js/features/user-settings.js
+++ b/web_src/js/features/user-settings.js
@@ -4,6 +4,7 @@ function onPronounsDropdownUpdate() {
const pronounsCustom = document.getElementById('pronouns-custom');
const pronounsDropdown = document.getElementById('pronouns-dropdown');
const pronounsInput = pronounsDropdown.querySelector('input');
+ // must be kept in sync with `routers/web/user/setting/profile.go`
const isCustom = !(
pronounsInput.value === '' ||
pronounsInput.value === 'he/him' ||
@@ -49,8 +50,12 @@ export function initUserSettings() {
const pronounsDropdown = document.getElementById('pronouns-dropdown');
const pronounsCustom = document.getElementById('pronouns-custom');
const pronounsInput = pronounsDropdown.querySelector('input');
+
+ // If JS is disabled, the page will show the custom input, as the dropdown requires JS to work.
+ // JS progressively enhances the input by adding a dropdown, but it works regardless.
pronounsCustom.removeAttribute('name');
pronounsDropdown.style.display = '';
+
onPronounsDropdownUpdate();
pronounsInput.addEventListener('change', onPronounsDropdownUpdate);
pronounsCustom.addEventListener('input', onPronounsCustomUpdate);