Skip to content

Commit

Permalink
fix: prevent scroll if audio player focus
Browse files Browse the repository at this point in the history
  • Loading branch information
lijinke666 committed Jul 30, 2020
1 parent 730c49d commit 4f9087a
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
17 changes: 17 additions & 0 deletions .github/workflows/stale.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Number of days of inactivity before an issue becomes stale
daysUntilStale: 60
# Number of days of inactivity before a stale issue is closed
daysUntilClose: 7
# Issues with these labels will never be considered stale
exemptLabels:
- pinned
- security
# Label to use when marking an issue as stale
staleLabel: wontfix
# Comment to post when marking an issue as stale. Set to `false` to disable
markComment: >
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
# Comment to post when closing a stale issue. Set to `false` to disable
# closeComment: false
5 changes: 2 additions & 3 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -1032,8 +1032,7 @@ export default class ReactJkMusicPlayer extends PureComponent {
this.setState({ toggle: true })
this.props.onModeChange && this.props.onModeChange(MODE.FULL)
if (spaceBar && this.player.current) {
// FIXME: focus 后 如果有滚动条 会滚动到底部
this.player.current.focus()
this.player.current.focus({ preventScroll: true })
}
}
}
Expand Down Expand Up @@ -2029,7 +2028,7 @@ export default class ReactJkMusicPlayer extends PureComponent {
bindKeyDownEvents = () => {
if (this.props.spaceBar && this.player.current) {
this.player.current.addEventListener('keydown', this.onKeyDown, false)
this.player.current.focus()
this.player.current.focus({ preventScroll: true })
}
}

Expand Down

0 comments on commit 4f9087a

Please sign in to comment.