Commit 2dae07fa authored by JC Brand's avatar JC Brand

Fixes #1791: Adhere to the auto_focus setting

parent 224f41ca
......@@ -30,6 +30,7 @@
- #1691: Fix `collection.chatbox is undefined` errors
- #1767: `credentials_url` is not called when logging out and then in again
- #1772: `_converse.api.contact.add(jid, nick)` fails, says not a function
- #1791: `auto_focus` set to `false` is ignored when switching back to a MUC
- #1792: Fix: modals don't have scrollbars
- #1796: Don't show "back" arrow navigation (on mobile) in the chat header when in `singleton` mode
- #1821: Errors caused by malformed URLs are now handled
......
......@@ -1214,6 +1214,10 @@ converse.plugins.add('converse-chatview', {
return this;
},
maybeFocus () {
_converse.auto_focus && this.focus();
},
hide () {
this.el.classList.add('hidden');
return this;
......@@ -1223,16 +1227,12 @@ converse.plugins.add('converse-chatview', {
this.model.clearUnreadMsgCounter();
this.model.setChatState(_converse.ACTIVE);
this.scrollDown();
if (_converse.auto_focus) {
this.focus();
}
this.maybeFocus();
},
show () {
if (u.isVisible(this.el)) {
if (_converse.auto_focus) {
this.focus();
}
this.maybeFocus();
return;
}
/**
......
......@@ -1131,9 +1131,7 @@ converse.plugins.add('converse-muc-views', {
} else if (conn_status === converse.ROOMSTATUS.ENTERED) {
this.renderBottomPanel();
this.hideSpinner();
if (_converse.auto_focus) {
this.focus();
}
this.maybeFocus();
} else if (conn_status === converse.ROOMSTATUS.DISCONNECTED) {
this.showDisconnectMessage();
} else if (conn_status === converse.ROOMSTATUS.DESTROYED) {
......
......@@ -134,7 +134,7 @@ converse.plugins.add('converse-roomslist', {
'name': name || Strophe.unescapeNode(Strophe.getNodeFromJid(jid)) || jid
}
await _converse.api.rooms.open(jid, data, true);
_converse.api.chatviews.get(jid).focus();
_converse.api.chatviews.get(jid).maybeFocus();
},
closeRoom (ev) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment