Style refresh issue in radio inputs when using a template

82 views
Skip to first unread message

Eskha

unread,
Nov 20, 2020, 12:25:15 PM11/20/20
to TiddlyWiki
Hello,

I have an issue with style refresh while using RadioWidget in a view template element.


I am using Edge - Version 86.

I have defined a style to use for the label of a a radio button input when it is selected (by using the "tc-radio-selected"). This is working when I directly use the RadioWidget  in a tiddler.
However, if I use the RadioWidget in a tiddler tagged with "$:/tags/ViewTemplate", the style is not refreshed unless I edit the tiddler or close it then open it again.


Here is a minimal test case with three tiddlers:

title: Test Template
tags: $:/tags/ViewTemplate

<$radio field="test-field" value="Y">Yes</$radio>
<$radio field="test-field" value="N">No</$radio>


title: Test CSS
tags: $:/tags/Stylesheet

label.tc-radio-selected {
background-color: #ffc;
}


title: Test

<$radio field="test-field" value="Y">Yes</$radio>
<$radio field="test-field" value="N">No</$radio>

My question: How can I fix it?
(Am i doing something wrong? Is-it a widget issue? An internet browser issue? à

Best regards,

Eskha

TW Tones

unread,
Nov 23, 2020, 6:21:01 PM11/23/20
to TiddlyWiki
Eskha,

I used your minimal test case on edge and it is not working through the Test tiddler (Via the view template) although it works in Chrome and Firefox.

However I changed the CSS to the following and it works in edge.

.tc-radio-selected {
background-color: #ffc;
}

I do not know why but I think your use of label is treated differently.


Regards
Tones

Eskha

unread,
Nov 24, 2020, 1:09:24 PM11/24/20
to TiddlyWiki
Thank you Tones for your answer.

Unfortunately, it does not solve my issue: to have different background color on each label when it is selected.
For instance a green background when yes is selected and red one when no is selected.

After investigation, I wonder if there is not something to modify in the radio widget:
I have tried to add a  this.refreshSelf();
in RadioWidget.prototype.refresh function of the widget
under the if(changedTiddlers[this.radioTitle])  condition
and it works now without observable side effect!

However I am not a developper therefore it may be a mistake to do this.

Best regards,

Eskha



Saq Imtiaz

unread,
Nov 24, 2020, 1:41:13 PM11/24/20
to TiddlyWiki
@Eshka I think you are correct that there is a bug in the refreshing of the widget.

There is a ticket underway with work on the radio widget which might, amongst other things, resolve the problem.

Could you please test this version of the widget:

If that helps please let us know, then the upcoming 5.1.23 release of TW should resolve this.
Please do delete that version of the widget after testing so that you do not encounter any problems when upgrading.

Regards,
Saq

Eskha

unread,
Nov 26, 2020, 8:13:29 AM11/26/20
to TiddlyWiki
Hello Saq,

Thank you for this updated version of the radio widget.
I can confirm that it resolves the problem.


Best regards,

Eskha

Saq Imtiaz

unread,
Nov 26, 2020, 8:26:04 AM11/26/20
to TiddlyWiki
@eshka thank you for the feedback!
Reply all
Reply to author
Forward
0 new messages