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 26, 2023
1 parent e0c9805 commit 0e59b31
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions client/js/templates/EntriesPage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -598,8 +598,7 @@ export default class StateHolder extends React.Component {

// 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 Expand Up @@ -995,13 +994,15 @@ export default class StateHolder extends React.Component {
this.setSelectedEntry(current);
}

const currentElement = document.querySelector(`.entry[data-entry-id="${current}"]`);
window.requestAnimationFrame(() => {
const currentElement = document.querySelector(`.entry[data-entry-id="${current}"]`);

// scroll to element
autoScroll(currentElement);
// scroll to element
autoScroll(currentElement);

// focus the title link for better keyboard navigation
currentElement.querySelector('.entry-title-link').focus();
// focus the title link for better keyboard navigation
currentElement.querySelector('.entry-title-link').focus();
});
}
}

Expand Down

0 comments on commit 0e59b31

Please sign in to comment.