Skip to content

Commit

Permalink
Textarea use SetValue and textContent
Browse files Browse the repository at this point in the history
  • Loading branch information
linkdata committed Feb 8, 2024
1 parent 22ee06f commit 7b17c6e
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
4 changes: 4 additions & 0 deletions jaws.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,10 @@ function jawsSetValue(elem, str) {
elem.selected = jawsIsTrue(str);
return;
}
if (elem.tagName.toLowerCase() === 'textarea') {
elem.textContent = str;
return;
}
if (elem.value == str) {
return;
}
Expand Down
2 changes: 1 addition & 1 deletion uitextarea.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ func (ui *UiTextarea) JawsRender(e *Element, w io.Writer, params []any) error {
}

func (ui *UiTextarea) JawsUpdate(e *Element) {
e.SetInner(template.HTML(ui.JawsGetString(e))) // #nosec G203
e.SetValue(ui.JawsGetString(e))
}

func NewUiTextarea(g StringSetter) (ui *UiTextarea) {
Expand Down
2 changes: 1 addition & 1 deletion uitextarea_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func TestRequest_Textarea(t *testing.T) {
case <-th.C:
th.Timeout()
case s := <-rq.outCh:
if s != "Inner\tJid.1\t\"quux\"\n" {
if s != "Value\tJid.1\t\"quux\"\n" {
t.Fail()
}
}
Expand Down

0 comments on commit 7b17c6e

Please sign in to comment.