Auto focus button in timer view
This commit is contained in:
@@ -25,7 +25,7 @@ export default function TimerView({ timedActivity, onStopTimer }) {
|
|||||||
offset={timedActivity.seconds}
|
offset={timedActivity.seconds}
|
||||||
style={{ fontSize: "36px", display: "inline-block" }}
|
style={{ fontSize: "36px", display: "inline-block" }}
|
||||||
/>
|
/>
|
||||||
<button className="moco-bx-btn btn-stop-timer" onClick={handleStopTimer}>
|
<button className="moco-bx-btn btn-stop-timer" onClick={handleStopTimer} autoFocus>
|
||||||
<StopWatch />
|
<StopWatch />
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -19,13 +19,6 @@ const Popup = forwardRef((props, ref) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
// Document might lose focus when clicking the browser action.
|
|
||||||
// Document might be out of focus when hitting the shortcut key.
|
|
||||||
// This puts the focus back to the document and ensures that:
|
|
||||||
// - the autofocus on the hours input field is triggered
|
|
||||||
// - the ESC key closes the popup without closing anything else
|
|
||||||
window.focus()
|
|
||||||
document.activeElement?.blur()
|
|
||||||
window.addEventListener("message", handleMessage)
|
window.addEventListener("message", handleMessage)
|
||||||
return () => {
|
return () => {
|
||||||
window.removeEventListener("message", handleMessage)
|
window.removeEventListener("message", handleMessage)
|
||||||
|
|||||||
Reference in New Issue
Block a user