tmedwards / sugarcube-2

SugarCube is a free (gratis and libre) story format for Twine/Twee.
https://www.motoslave.net/sugarcube/2/
BSD 2-Clause "Simplified" License
177 stars 41 forks source link

put roles in some elements of sugarCube. #232

Open metalalchemist opened 1 year ago

metalalchemist commented 1 year ago

Is your feature request related to a problem? hello when i am playing my game in ifone, the device don't recognice links with voice ovber. i am a blind person. Describe the solution you'd like. put some roles in elements linke links and buttons like.

$(document).on(":passagerender", function (event) { var clinks = $(event.content).find(".link-internal"); if (clinks.length) { clinks.attr( "role", "link"); } var clinks = $(event.content).find('.macro-button'); if (clinks.length) { clinks.attr( "role", "button"); } });

sorry my english is so bad and i don't understand so mutch js.

greyelf commented 1 year ago

@metalalchemist The current Markup based and Macro based link implementations, and the <<button>> macro implementation, already include a role="link" assignment in the HTML <a> and <button> elements they generate.

eg. If the following was placed in a Passage...

[[Lable Text|Target Passage]]

<<link "Lable Text" "Target Passage">><</link>>

<<button "Lable Text" "Target Passage">><</button>>

...the following HTML elements would be generated...

<a data-passage="Target Passage" class="link-internal" role="link" tabindex="0">Lable Text</a>

<a data-passage="Target Passage" class="link-internal macro-link" role="link" tabindex="0">Lable Text</a>

<button data-passage="Target Passage" class="link-internal macro-button" type="button" role="link" tabindex="0">Lable Text</button>

Do you know what Reader software is being used on your iPhone?

Do you know what version of SugarCube was used to build the Story HTML file you are playing?

metalalchemist commented 1 year ago

i am using voice over and i am using sugarcube 2.36.1.

<button data-passage="Target Passage" class="link-internal macro-button" type="button" role="link" why do you use role button? i use buttons for example for a figth passage.

metalalchemist commented 1 year ago

i forget for compile i am using tweego 2.1.1

tmedwards commented 1 year ago

As noted by @greyelf, links (anchors and buttons) already have a role content attribute attached normally, among other accessibility features. The value of the attribute depends on how it's being used (by default: link or button).

I'm going to need a bit more context from you. Can you provide an example of how you're creating the links that you're having issues with. Also, preferably, including the generated markup.

EDIT: Are you using any 3rd-party libraries that could be interfering with SugarCube's normal operation?

metalalchemist commented 1 year ago

link macro i thing that have role button cause i recognise in all screen readers like a button. [[new game|new]] when use sugarcube 2.35 don't have a role and in sugarcube 2.36.1 my ifone don't recognise it like a link. i read like a text plain. ps: the passage don't focus in the start of this. for example if i havee 5 lines or more in the reader when down with downarrow i apear in a 4th line no in a 2nd line. with all screen readers in android and ifone too i thing that is for the transition?