Skip to content

Commit 331bf8d

Browse files
fix: revert change from readonly to disabled on liaison from contact (ietf-tools#4708)
* feat: apply 'readonly' property to select2 inputs * fix: revert change from readonly to disabled on liaison from contact
1 parent d7f5c20 commit 331bf8d

2 files changed

Lines changed: 19 additions & 1 deletion

File tree

ietf/liaisons/forms.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -510,7 +510,7 @@ def set_from_fields(self):
510510
else:
511511
email = self.person.email_address()
512512
self.fields['from_contact'].initial = email
513-
self.fields['from_contact'].widget.attrs['disabled'] = True
513+
self.fields['from_contact'].widget.attrs['readonly'] = True
514514

515515
def set_to_fields(self):
516516
'''Set to_groups and to_contacts options and initial value based on user

ietf/static/css/select2.scss

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,21 @@
33
@import "bootstrap/scss/mixins";
44
@import "select2/src/scss/core";
55
@import "select2-bootstrap-5-theme/src/include-all";
6+
7+
// Propagate readonly property from input to select2 instrumentation, based on
8+
// https://stackoverflow.com/questions/41807096/select2-make-it-readonly-not-disabled-from-js/55001516#55001516
9+
select[readonly].select2-hidden-accessible + .select2-container {
10+
pointer-events: none;
11+
touch-action: none;
12+
13+
.select2-selection {
14+
background: $form-select-disabled-bg;
15+
color: $form-select-disabled-color;
16+
border-color: $form-select-disabled-border-color;
17+
box-shadow: none;
18+
}
19+
20+
.select2-selection__arrow, .select2-selection__clear {
21+
display: none;
22+
}
23+
}

0 commit comments

Comments
 (0)