Skip to content

Commit

Permalink
Fix keyboard navigation with scroll_to_article_header=0
Browse files Browse the repository at this point in the history
  • Loading branch information
PhrozenByte committed Nov 24, 2023
1 parent e0c9805 commit b4d0434
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions client/js/templates/EntriesPage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -587,19 +587,23 @@ export default class StateHolder extends React.Component {
* @param {number} id of entry
*/
activateEntry(id) {
const entry = this.state.entries.find((entry) => id === entry.id);
const element = document.querySelector(`.entry[data-entry-id="${id}"]`);

if (this.props.configuration.autoCollapse) {
this.collapseAllEntries();
}

this.setSelectedEntry(id);

// scroll to entry
element.scrollIntoView();

// show/hide (with toolbar)
this.setEntryExpanded(id, true);

// automark as read
const entry = this.state.entries.find((entry) => id === entry.id);
const autoMarkAsRead = selfoss.isAllowedToWrite() && this.props.configuration.autoMarkAsRead && entry.unread == 1;
if (autoMarkAsRead) {
if (selfoss.isAllowedToWrite() && this.props.configuration.autoMarkAsRead && entry.unread == 1) {
this.markEntryRead(id, true);
}
}
Expand Down

0 comments on commit b4d0434

Please sign in to comment.