Skip to content

Commit 73b41dc

Browse files
committed
Add padded label to file list/grid checkboxes
1 parent db264c1 commit 73b41dc

File tree

3 files changed

+28
-16
lines changed

3 files changed

+28
-16
lines changed

frontend/src/FileManager/FileList/FileItem.jsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,7 @@ const FileItem = ({
212212
id={file.name}
213213
checked={fileSelected}
214214
className={`selection-checkbox ${checkboxClassName}`}
215+
labelClassName={`selection-checkbox-label`}
215216
onChange={handleCheckboxChange}
216217
onClick={(e) => e.stopPropagation()}
217218
/>

frontend/src/FileManager/FileList/FileList.scss

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,15 @@
6767
background-color: $item-hover-color;
6868
}
6969

70-
.selection-checkbox {
70+
.selection-checkbox-label {
7171
position: absolute;
72-
left: 5px;
73-
top: 8px;
72+
top: 0;
73+
left: 0;
74+
padding: 8px 5px;
75+
}
76+
77+
.selection-checkbox {
78+
position: static;
7479
}
7580

7681
.hidden {
@@ -199,8 +204,13 @@
199204
background-color: unset;
200205
}
201206

207+
.selection-checkbox-label {
208+
padding-top: 12px;
209+
padding-bottom: 12px;
210+
}
211+
202212
.selection-checkbox {
203-
top: 12px;
213+
position: static;
204214
}
205215

206216
.file-name {

frontend/src/components/Checkbox/Checkbox.jsx

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,19 @@
11
import "./Checkbox.scss";
22

3-
const Checkbox = ({ name, id, checked, onClick, onChange, className = "", title, disabled = false }) => {
3+
const Checkbox = ({ name, id, checked, onClick, onChange, className = "", labelClassName = "", title, disabled = false }) => {
44
return (
5-
<input
6-
className={`fm-checkbox ${className}`}
7-
type="checkbox"
8-
name={name}
9-
id={id}
10-
checked={checked}
11-
onClick={onClick}
12-
onChange={onChange}
13-
title={title}
14-
disabled={disabled}
15-
/>
5+
<label htmlFor={id} aria-label={`${name} checkbox`} onClick={onClick} className={labelClassName}>
6+
<input
7+
className={`fm-checkbox ${className}`}
8+
type="checkbox"
9+
name={name}
10+
id={id}
11+
checked={checked}
12+
onChange={onChange}
13+
title={title}
14+
disabled={disabled}
15+
/>
16+
</label>
1617
);
1718
};
1819

0 commit comments

Comments
 (0)