Fossil SCM

/chat: 1) force the cursor on the input element to always be 'text' (I-beam), even when it doesn't have focus (browser inconsistency) and 2) when the chat window regains visibility after having lost it, give focus to the input element to try to work around a problem where Pale Moon is giving focus to one of the pseudo-buttons. Change (2) comes with a couple of minor but annoying quirks and might have to be undone, but it's worth a try.

stephan 2021-10-07 16:27 trunk
Commit 503395796e5f9772fc519b3b0399c848a5fd6d5a85128d0e04fbf0e7fd1b3a0d
--- src/fossil.page.chat.js
+++ src/fossil.page.chat.js
@@ -780,10 +780,19 @@
780780
};
781781
document.addEventListener('visibilitychange', function(ev){
782782
cs.pageIsActive = ('visible' === document.visibilityState);
783783
if(cs.pageIsActive){
784784
cs.e.pageTitle.innerText = cs.pageTitleOrig;
785
+ console.debug("Taking back input focus.");
786
+ cs.inputFocus(
787
+ /* An attempt to resolve usability problem reported by Joe
788
+ M. where the Pale Moon browser is giving input focus to
789
+ the Preview button. The down-side of this is that it will
790
+ deselect any text which was previously selected on this
791
+ page. This also, unfortunately, places the focus at the
792
+ start of the element, rather than the last cursor position
793
+ (like a textarea would). */);
785794
}
786795
}, true);
787796
cs.setCurrentView(cs.e.viewMessages);
788797
789798
cs.e.activeUserList.addEventListener('click', function f(ev){
790799
--- src/fossil.page.chat.js
+++ src/fossil.page.chat.js
@@ -780,10 +780,19 @@
780 };
781 document.addEventListener('visibilitychange', function(ev){
782 cs.pageIsActive = ('visible' === document.visibilityState);
783 if(cs.pageIsActive){
784 cs.e.pageTitle.innerText = cs.pageTitleOrig;
 
 
 
 
 
 
 
 
 
785 }
786 }, true);
787 cs.setCurrentView(cs.e.viewMessages);
788
789 cs.e.activeUserList.addEventListener('click', function f(ev){
790
--- src/fossil.page.chat.js
+++ src/fossil.page.chat.js
@@ -780,10 +780,19 @@
780 };
781 document.addEventListener('visibilitychange', function(ev){
782 cs.pageIsActive = ('visible' === document.visibilityState);
783 if(cs.pageIsActive){
784 cs.e.pageTitle.innerText = cs.pageTitleOrig;
785 console.debug("Taking back input focus.");
786 cs.inputFocus(
787 /* An attempt to resolve usability problem reported by Joe
788 M. where the Pale Moon browser is giving input focus to
789 the Preview button. The down-side of this is that it will
790 deselect any text which was previously selected on this
791 page. This also, unfortunately, places the focus at the
792 start of the element, rather than the last cursor position
793 (like a textarea would). */);
794 }
795 }, true);
796 cs.setCurrentView(cs.e.viewMessages);
797
798 cs.e.activeUserList.addEventListener('click', function f(ev){
799
--- src/style.chat.css
+++ src/style.chat.css
@@ -191,10 +191,13 @@
191191
overflow: auto;
192192
resize: vertical;
193193
white-space: pre-wrap;
194194
/* ^^^ Firefox, when pasting plain text into a contenteditable field,
195195
loses all newlines unless we explicitly set this. Chrome does not. */
196
+ cursor: text;
197
+ /* ^^^ In some browsers the cursor may not change for a contenteditable
198
+ element until it has focus, causing potential confusion. */
196199
}
197200
#chat-input-field:empty::before {
198201
content: attr(data-placeholder);
199202
opacity: 0.6;
200203
}
201204
--- src/style.chat.css
+++ src/style.chat.css
@@ -191,10 +191,13 @@
191 overflow: auto;
192 resize: vertical;
193 white-space: pre-wrap;
194 /* ^^^ Firefox, when pasting plain text into a contenteditable field,
195 loses all newlines unless we explicitly set this. Chrome does not. */
 
 
 
196 }
197 #chat-input-field:empty::before {
198 content: attr(data-placeholder);
199 opacity: 0.6;
200 }
201
--- src/style.chat.css
+++ src/style.chat.css
@@ -191,10 +191,13 @@
191 overflow: auto;
192 resize: vertical;
193 white-space: pre-wrap;
194 /* ^^^ Firefox, when pasting plain text into a contenteditable field,
195 loses all newlines unless we explicitly set this. Chrome does not. */
196 cursor: text;
197 /* ^^^ In some browsers the cursor may not change for a contenteditable
198 element until it has focus, causing potential confusion. */
199 }
200 #chat-input-field:empty::before {
201 content: attr(data-placeholder);
202 opacity: 0.6;
203 }
204

Keyboard Shortcuts

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