Roll20 uses cookies to improve your experience on our site. Cookies enable you to enjoy certain features, social sharing functionality, and tailor message and display ads to your interests on our site and others. They also help us understand how our site is being used. By continuing to use our site, you consent to our use of cookies. Update your cookie preferences .
×
Create a free account

Unresponsive action-button in repeating section. Solution

Оригинальная тема:&nbsp; <a href="https://app.roll20.net/forum/post/10763893/unresponsive-action-button-in-repeating-section" rel="nofollow">https://app.roll20.net/forum/post/10763893/unresponsive-action-button-in-repeating-section</a> &nbsp;&nbsp;&nbsp;&nbsp;Столкнувшись с данной проблемой смог найти небольшой костыль. Т.к. button ни одного типа не работает вообще, я использую input: type='checkbox' , с изменённым стилем через label : HTML: &lt; label class = "sheet-input_checkbox_style" &gt; &nbsp;&nbsp;&nbsp;&nbsp; &lt; input &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; type = 'checkbox' &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; name = 'attr_button' &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; class = 'sheet-hidden' &nbsp;&nbsp;&nbsp;&nbsp; /&gt; &nbsp;&nbsp;&nbsp;&nbsp; &lt; span &gt; × &lt;/ span &gt; &lt;/ label &gt; CSS: .charsheet .sheet-hidden { &nbsp;&nbsp;&nbsp;&nbsp; display : none !important ; } .charsheet . sheet-input_checkbox_style { &nbsp;&nbsp;&nbsp;&nbsp; font-size : 14px ; &nbsp;&nbsp;&nbsp;&nbsp; font-weight : bold ; &nbsp;&nbsp;&nbsp;&nbsp; display : flex ; &nbsp;&nbsp;&nbsp;&nbsp; justify-content : center ; &nbsp;&nbsp;&nbsp;&nbsp; align-items : center ; &nbsp;&nbsp;&nbsp;&nbsp; user-select : none ; } .charsheet . sheet-input_checkbox_style :hover { &nbsp;&nbsp;&nbsp;&nbsp; color : red ; } &nbsp;&nbsp;&nbsp;&nbsp;Теперь при нажатии на label происходит изменение&nbsp; checkbox , который привязан к атрибуту " button ". Вследствие&nbsp;всего этого можно использовать подобный код: on ( 'change:repeating_element:button' , function ( e ) { &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;&nbsp;&nbsp;// Code Here &nbsp; &nbsp; &nbsp; &nbsp; }); &nbsp;&nbsp;&nbsp;&nbsp;Так как нам неважно, какое значение примет&nbsp; checkbox , мы просто отслеживаем его любое изменение, которое происходит при нажатии (аналогично кнопке).
[Google Translate] Original forum:&nbsp; <a href="https://app.roll20.net/forum/post/10763893/unresponsive-action-button-in-repeating-section" rel="nofollow">https://app.roll20.net/forum/post/10763893/unresponsive-action-button-in-repeating-section</a> &nbsp;&nbsp;&nbsp;&nbsp;Faced with this problem, I was able to find a small crutch. Because button neither type works at all, I use input: type='checkbox' , styled via label : HTML: &lt; label class = "sheet-input_checkbox_style" &gt; &nbsp;&nbsp;&nbsp;&nbsp; &lt; input &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; type = 'checkbox' &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; name = 'attr_button' &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; class = 'sheet-hidden' &nbsp;&nbsp;&nbsp;&nbsp; /&gt; &nbsp;&nbsp;&nbsp;&nbsp; &lt; span &gt; × &lt;/ span &gt; &lt;/ label &gt; CSS: .charsheet .sheet-hidden { &nbsp;&nbsp;&nbsp;&nbsp; display : none !important ; } .charsheet . sheet-input_checkbox_style { &nbsp;&nbsp;&nbsp;&nbsp; font-size : 14px ; &nbsp;&nbsp;&nbsp;&nbsp; font-weight : bold ; &nbsp;&nbsp;&nbsp;&nbsp; display : flex ; &nbsp;&nbsp;&nbsp;&nbsp; justify-content : center ; &nbsp;&nbsp;&nbsp;&nbsp; align-items : center ; &nbsp;&nbsp;&nbsp;&nbsp; user-select : none ; } .charsheet . sheet-input_checkbox_style :hover { &nbsp;&nbsp;&nbsp;&nbsp; color : red ; } &nbsp;&nbsp;&nbsp;&nbsp;Now when you click on the label , the checkbox is changed, which is attached to the " button " attribute. As a result of all this, you can use code like this: on ( 'change:repeating_element:button' , function ( e ) { &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;&nbsp;&nbsp;// Code Here &nbsp; &nbsp; &nbsp; &nbsp; }); &nbsp;&nbsp;&nbsp;&nbsp;Since we don't care what value the checkbox will take, we simply keep track of any change that occurs when it is clicked (similar to a button).
1685473200

Edited 1685473372
vÍnce
Pro
Sheet Author
Interesting. Screen shot?&nbsp; Can you drag/drop the button to the quickbar as well? Guessing not since it's still not actually a button.
1685475583

Edited 1685475627
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
or you just fix the CSS as I noted further down in that post. If you absolutely have to have a position property applied to your button, or it's ancestors, then this is a work around. However, there's very few times when using position is the only way to achieve the layout you want. Also, as Vince noted, you do lose some functionality of the action button. While action buttons can't be dragged to the macro bar anyways, you do lose the ability to trigger this from chat (at least without an API script).
vÍnce &nbsp;said: Interesting. Screen shot?&nbsp; Can you drag/drop the button to the quickbar as well? Guessing not since it's still not actually a button. Нет, но я использую эту "кнопку" для отчистки поля ввода Фильтра, поэтому в подобном нет необходимости. К тому же, насколько я знаю, это можно сделать только для type="roll" кнопок. [Google Translate] No, but I'm using this "button" to clear the Filter input field, so there's no need for that. Also, as far as I know, this can only be done for type="roll" buttons.
Scott C. said: or you just fix the CSS as I noted further down in that post. If you absolutely have to have a position property applied to your button, or it's ancestors, then this is a work around. However, there's very few times when using position is the only way to achieve the layout you want. Also, as Vince noted, you do lose some functionality of the action button. While action buttons can't be dragged to the macro bar anyways, you do lose the ability to trigger this from chat (at least without an API script). Я использую в своём листе отдельные окна, которые отображаются поверх основного листа, поэтому не могу избежать изменение position.&nbsp; [Google Translate] I use separate windows in my sheet that are displayed on top of the main sheet, so I can't avoid changing the position.