Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rework focus and blur event handlers #524

Merged
merged 1 commit into from
Aug 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions frontend/src/components/Cell.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export const Cell = ({
const onEscapeArea = (e: any) => {
{
if (e.key === "Escape") {
setShowCommentArea(false);
onBlurArea();
}
}
};
Expand Down Expand Up @@ -97,10 +97,10 @@ export const Cell = ({
date,
"yyyy-MM-dd"
)}`}
onChange={onCellChange}
onKeyUp={onDeleteCellEntry}
onFocus={onFocusRow}
onBlur={onBlurRow}
onChange={(ev) => onCellChange(ev)}
onKeyUp={(ev) => onDeleteCellEntry(ev)}
onFocus={() => onFocusRow()}
onBlur={() => onBlurRow()}
className="cell"
defaultValue={hours === 0 ? "" : hours}
/>
Expand All @@ -109,7 +109,7 @@ export const Cell = ({
className={comments === "" ? "comment comment-unfilled" : "comment"}
type="button"
title="Toggle comment area"
onFocus={onFocusRow}
onFocus={() => onFocusRow()}
onClick={() => onCommentButtonClick()}
></button>
)}
Expand All @@ -119,14 +119,14 @@ export const Cell = ({
<textarea
autoFocus
className="comment-area"
onChange={onCommentUpdate}
onChange={(ev) => onCommentUpdate(ev)}
placeholder="Comments"
name="comments"
rows={2}
maxLength={1000}
onKeyUp={onEscapeArea}
onFocus={onFocusRow}
onBlur={onBlurArea}
onKeyUp={(ev) => onEscapeArea(ev)}
onFocus={() => onFocusRow()}
onBlur={() => onBlurArea()}
defaultValue={areaComments !== null ? areaComments : comments}
/>
<button
Expand Down
10 changes: 5 additions & 5 deletions frontend/src/components/Row.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -117,12 +117,12 @@ export const Row = ({
)}`}
topic={topic}
date={day}
onCellUpdate={onCellUpdate}
onCellUpdate={(ev) => onCellUpdate(ev)}
hours={rowHours[i]}
comments={rowEntries[i] ? rowEntries[i].comments : ""}
entryId={rowEntries[i] ? rowEntries[i].id : 0}
onFocusRow={onFocusRow}
onBlurRow={onBlurRow}
onFocusRow={() => onFocusRow()}
onBlurRow={() => onBlurRow()}
/>
);
})}
Expand All @@ -134,8 +134,8 @@ export const Row = ({
className="cell"
value={getRowSum(topic)}
readOnly
onFocus={onFocusRow}
onBlur={onBlurRow}
onFocus={() => onFocusRow()}
onBlur={() => onBlurRow()}
tabIndex={-1}
/>
</div>
Expand Down