Fossil SCM

/chat: removed some debug output. Reformulated part of the previous checkin to only re-grab input focus if the input field is not document.activeElement.

stephan 2021-10-07 16:45 trunk
Commit 85a99733d543b965dd0bdeb0ae74d418e5c4c732e8e5eea2e8ecbf80a0b94c74
1 file changed +4 -3
--- src/fossil.page.chat.js
+++ src/fossil.page.chat.js
@@ -780,19 +780,20 @@
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(
785
+ if(document.activeElement!==cs.inputElement()){
787786
/* An attempt to resolve usability problem reported by Joe
788787
M. where the Pale Moon browser is giving input focus to
789788
the Preview button. The down-side of this is that it will
790789
deselect any text which was previously selected on this
791790
page. This also, unfortunately, places the focus at the
792791
start of the element, rather than the last cursor position
793
- (like a textarea would). */);
792
+ (like a textarea would). */
793
+ cs.inputFocus();
794
+ }
794795
}
795796
}, true);
796797
cs.setCurrentView(cs.e.viewMessages);
797798
798799
cs.e.activeUserList.addEventListener('click', function f(ev){
799800
--- src/fossil.page.chat.js
+++ src/fossil.page.chat.js
@@ -780,19 +780,20 @@
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/fossil.page.chat.js
+++ src/fossil.page.chat.js
@@ -780,19 +780,20 @@
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 if(document.activeElement!==cs.inputElement()){
 
786 /* An attempt to resolve usability problem reported by Joe
787 M. where the Pale Moon browser is giving input focus to
788 the Preview button. The down-side of this is that it will
789 deselect any text which was previously selected on this
790 page. This also, unfortunately, places the focus at the
791 start of the element, rather than the last cursor position
792 (like a textarea would). */
793 cs.inputFocus();
794 }
795 }
796 }, true);
797 cs.setCurrentView(cs.e.viewMessages);
798
799 cs.e.activeUserList.addEventListener('click', function f(ev){
800

Keyboard Shortcuts

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