Fossil SCM

chat: ARIA-related attribute changes suggested in the forum.

stephan 2020-12-27 09:05 trunk
Commit ca7aae80ad701e4d4b91b911599ccd01260b43e28bfc7c69367ff18ba4ceec3c
2 files changed +2 -1 +5 -6
+2 -1
--- src/chat.c
+++ src/chat.c
@@ -122,11 +122,12 @@
122122
@ <textarea rows="8" id="chat-input-multi" \
123123
@ placeholder="Type message here" class="hidden"></textarea>
124124
@ <input type="submit" value="Send" id="chat-message-submit">
125125
@ <button id="chat-scroll-bottom">&darr;</button>
126126
@ <button id="chat-scroll-top">&uarr;</button>
127
- @ <span id="chat-settings-button" class="settings-icon"></span>
127
+ @ <span id="chat-settings-button" class="settings-icon" \
128
+ @ aria-label="Settings..." aria-haspopup="true" ></span>
128129
@ </div>
129130
@ <div id='chat-input-file-area'>
130131
@ <div class='file-selection-wrapper'>
131132
@ <div class='help-buttonlet'>
132133
@ Select a file to upload, drag/drop a file into this spot,
133134
--- src/chat.c
+++ src/chat.c
@@ -122,11 +122,12 @@
122 @ <textarea rows="8" id="chat-input-multi" \
123 @ placeholder="Type message here" class="hidden"></textarea>
124 @ <input type="submit" value="Send" id="chat-message-submit">
125 @ <button id="chat-scroll-bottom">&darr;</button>
126 @ <button id="chat-scroll-top">&uarr;</button>
127 @ <span id="chat-settings-button" class="settings-icon"></span>
 
128 @ </div>
129 @ <div id='chat-input-file-area'>
130 @ <div class='file-selection-wrapper'>
131 @ <div class='help-buttonlet'>
132 @ Select a file to upload, drag/drop a file into this spot,
133
--- src/chat.c
+++ src/chat.c
@@ -122,11 +122,12 @@
122 @ <textarea rows="8" id="chat-input-multi" \
123 @ placeholder="Type message here" class="hidden"></textarea>
124 @ <input type="submit" value="Send" id="chat-message-submit">
125 @ <button id="chat-scroll-bottom">&darr;</button>
126 @ <button id="chat-scroll-top">&uarr;</button>
127 @ <span id="chat-settings-button" class="settings-icon" \
128 @ aria-label="Settings..." aria-haspopup="true" ></span>
129 @ </div>
130 @ <div id='chat-input-file-area'>
131 @ <div class='file-selection-wrapper'>
132 @ <div class='help-buttonlet'>
133 @ Select a file to upload, drag/drop a file into this spot,
134
+5 -6
--- src/chat.js
+++ src/chat.js
@@ -183,16 +183,15 @@
183183
eMsg (the liklihood is good, at least on initial page load,
184184
that the the image won't be loaded until other messages have
185185
been injected). */
186186
scheduleScrollOfMsg: function(eMsg){
187187
if(1===+eMsg.dataset.hasImage){
188
- console.debug("Delaying scroll for IMG.");
189188
eMsg.querySelector('img').addEventListener(
190
- 'load', ()=>(this.e.newestMessage || eMsg).scrollIntoView()
189
+ 'load', ()=>(this.e.newestMessage || eMsg).scrollIntoView(false)
191190
);
192191
}else{
193
- eMsg.scrollIntoView();
192
+ eMsg.scrollIntoView(false);
194193
}
195194
return this;
196195
},
197196
/* Injects element e as a new row in the chat, at the top of the
198197
list if atEnd is falsy, else at the end of the list, before
@@ -244,11 +243,11 @@
244243
message arrives).
245244
*/
246245
if(1===+e.dataset.hasImage){
247246
e.querySelector('img').addEventListener('load',()=>e.scrollIntoView());
248247
}else if(!prevMessage || (prevMessage && isInViewport(prevMessage))){
249
- e.scrollIntoView();
248
+ e.scrollIntoView(false);
250249
}
251250
}
252251
},
253252
/** Returns true if chat-only mode is enabled. */
254253
isChatOnlyMode: ()=>document.body.classList.contains('chat-only-mode'),
@@ -804,18 +803,18 @@
804803
settingsPopup.options.refresh = function(){
805804
D.clearElement(this.e);
806805
settingsOps.forEach(function(op){
807806
const line = D.addClass(D.span(), 'menu-entry');
808807
const btn = D.append(D.addClass(D.span(), 'button'), op.label);
809
- D.attr(btn, 'role', 'button');
810808
const callback = function(ev){
811809
settingsPopup.hide();
812810
op.callback.call(this,ev);
813811
};
814812
D.append(line, btn);
815813
if(op.hasOwnProperty('boolValue')){
816
- const check = D.checkbox(1, op.boolValue());
814
+ const check = D.attr(D.checkbox(1, op.boolValue()),
815
+ 'aria-label', op.label);
817816
D.append(line, check);
818817
check.addEventListener('click', callback);
819818
}
820819
D.append(settingsPopup.e, line);
821820
btn.addEventListener('click', callback);
822821
--- src/chat.js
+++ src/chat.js
@@ -183,16 +183,15 @@
183 eMsg (the liklihood is good, at least on initial page load,
184 that the the image won't be loaded until other messages have
185 been injected). */
186 scheduleScrollOfMsg: function(eMsg){
187 if(1===+eMsg.dataset.hasImage){
188 console.debug("Delaying scroll for IMG.");
189 eMsg.querySelector('img').addEventListener(
190 'load', ()=>(this.e.newestMessage || eMsg).scrollIntoView()
191 );
192 }else{
193 eMsg.scrollIntoView();
194 }
195 return this;
196 },
197 /* Injects element e as a new row in the chat, at the top of the
198 list if atEnd is falsy, else at the end of the list, before
@@ -244,11 +243,11 @@
244 message arrives).
245 */
246 if(1===+e.dataset.hasImage){
247 e.querySelector('img').addEventListener('load',()=>e.scrollIntoView());
248 }else if(!prevMessage || (prevMessage && isInViewport(prevMessage))){
249 e.scrollIntoView();
250 }
251 }
252 },
253 /** Returns true if chat-only mode is enabled. */
254 isChatOnlyMode: ()=>document.body.classList.contains('chat-only-mode'),
@@ -804,18 +803,18 @@
804 settingsPopup.options.refresh = function(){
805 D.clearElement(this.e);
806 settingsOps.forEach(function(op){
807 const line = D.addClass(D.span(), 'menu-entry');
808 const btn = D.append(D.addClass(D.span(), 'button'), op.label);
809 D.attr(btn, 'role', 'button');
810 const callback = function(ev){
811 settingsPopup.hide();
812 op.callback.call(this,ev);
813 };
814 D.append(line, btn);
815 if(op.hasOwnProperty('boolValue')){
816 const check = D.checkbox(1, op.boolValue());
 
817 D.append(line, check);
818 check.addEventListener('click', callback);
819 }
820 D.append(settingsPopup.e, line);
821 btn.addEventListener('click', callback);
822
--- src/chat.js
+++ src/chat.js
@@ -183,16 +183,15 @@
183 eMsg (the liklihood is good, at least on initial page load,
184 that the the image won't be loaded until other messages have
185 been injected). */
186 scheduleScrollOfMsg: function(eMsg){
187 if(1===+eMsg.dataset.hasImage){
 
188 eMsg.querySelector('img').addEventListener(
189 'load', ()=>(this.e.newestMessage || eMsg).scrollIntoView(false)
190 );
191 }else{
192 eMsg.scrollIntoView(false);
193 }
194 return this;
195 },
196 /* Injects element e as a new row in the chat, at the top of the
197 list if atEnd is falsy, else at the end of the list, before
@@ -244,11 +243,11 @@
243 message arrives).
244 */
245 if(1===+e.dataset.hasImage){
246 e.querySelector('img').addEventListener('load',()=>e.scrollIntoView());
247 }else if(!prevMessage || (prevMessage && isInViewport(prevMessage))){
248 e.scrollIntoView(false);
249 }
250 }
251 },
252 /** Returns true if chat-only mode is enabled. */
253 isChatOnlyMode: ()=>document.body.classList.contains('chat-only-mode'),
@@ -804,18 +803,18 @@
803 settingsPopup.options.refresh = function(){
804 D.clearElement(this.e);
805 settingsOps.forEach(function(op){
806 const line = D.addClass(D.span(), 'menu-entry');
807 const btn = D.append(D.addClass(D.span(), 'button'), op.label);
 
808 const callback = function(ev){
809 settingsPopup.hide();
810 op.callback.call(this,ev);
811 };
812 D.append(line, btn);
813 if(op.hasOwnProperty('boolValue')){
814 const check = D.attr(D.checkbox(1, op.boolValue()),
815 'aria-label', op.label);
816 D.append(line, check);
817 check.addEventListener('click', callback);
818 }
819 D.append(settingsPopup.e, line);
820 btn.addEventListener('click', callback);
821

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button