Make unskipping by keybind easier for multiple segment notices by focusing by default

Clicking tab will focus the next button allowing you to unskip the next segment
This commit is contained in:
Ajay
2023-12-22 13:04:28 -05:00
parent 67c2a5bae7
commit 58d5036363

View File

@@ -388,6 +388,7 @@ class SkipNoticeComponent extends React.Component<SkipNoticeProps, SkipNoticeSta
style={{opacity: this.getSubmissionChooserOpacity(i), style={{opacity: this.getSubmissionChooserOpacity(i),
color: this.getSubmissionChooserColor(i)}} color: this.getSubmissionChooserColor(i)}}
onClick={() => this.performAction(i)} onClick={() => this.performAction(i)}
autoFocus={i == 0}
key={"submission" + i + this.segments[i].category + this.idSuffix}> key={"submission" + i + this.segments[i].category + this.idSuffix}>
{`${(i + 1)}. ${chrome.i18n.getMessage("category_" + {`${(i + 1)}. ${chrome.i18n.getMessage("category_" +
this.segments[i].category)} (${getFormattedTime(this.segments[i].segment[0])})`} this.segments[i].category)} (${getFormattedTime(this.segments[i].segment[0])})`}
@@ -459,6 +460,15 @@ class SkipNoticeComponent extends React.Component<SkipNoticeProps, SkipNoticeSta
if (this.segments.length === 1) { if (this.segments.length === 1) {
this.performAction(0, action); this.performAction(0, action);
} else { } else {
if (this.state.smaller) {
this.setState({
smaller: false
});
this.noticeRef.current.fadedMouseEnter();
this.noticeRef.current.resetCountdown();
}
switch (action ?? this.state.actionState) { switch (action ?? this.state.actionState) {
case SkipNoticeAction.None: case SkipNoticeAction.None:
this.resetStateToStart(); this.resetStateToStart();