Skip to content

Commit 58f2b66

Browse files
refactor: use buttons instead of deprecated javascript URLs (#1940)
1 parent d0fe611 commit 58f2b66

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+194
-147
lines changed

src/components/BrowserFilter/BrowserFilter.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@
138138
}
139139

140140
.remove {
141+
@include buttonReset;
141142
display: inline-block;
142143
height: 14px;
143144
margin: 8px;

src/components/BrowserFilter/FilterRow.react.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ let FilterRow = ({
103103
options={constraints.map((c) => Constraints[c].name)}
104104
onChange={(c) => onChangeConstraint(constraintLookup[c])} />
105105
{compareValue(compareInfo, compareTo, onChangeCompareTo, active, parentContentId)}
106-
<a role='button' href='javascript:;' className={styles.remove} onClick={onDeleteRow}><Icon name='minus-solid' width={14} height={14} fill='rgba(0,0,0,0.4)' /></a>
106+
<button type='button' className={styles.remove} onClick={onDeleteRow}><Icon name='minus-solid' width={14} height={14} fill='rgba(0,0,0,0.4)' /></button>
107107
</div>
108108
);
109109

src/components/Button/Button.react.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,14 @@ let Button = (props) => {
3939
styleOverride = { width: props.width, minWidth: props.width, ...props.additionalStyles };
4040
}
4141
return (
42-
<a
43-
href='javascript:;'
44-
role='button'
42+
<button
43+
type='button'
4544
style={styleOverride}
4645
className={classes.join(' ')}
4746
onClick={clickHandler}
4847
onFocus={(e) => { if (props.disabled) e.target.blur(); }} >
4948
<span>{props.value}</span>
50-
</a>
49+
</button>
5150
);
5251
}
5352

src/components/Button/Button.scss

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,15 @@
99

1010
.button {
1111
@include DosisFont;
12+
@include buttonReset($bg: none, $border: 1px solid $blue, $padding: 0 16px);
1213
display: inline-block;
1314
height: 30px;
14-
border: 1px solid $blue;
1515
line-height: 28px;
1616
outline: 0;
1717
text-decoration: none;
1818
text-align: center;
1919
border-radius: 5px;
20-
cursor: pointer;
2120
min-width: 110px;
22-
padding: 0 16px;
2321
font-size: 14px;
2422

2523
color: $blue;

src/components/Calendar/Calendar.react.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ export default class Calendar extends React.Component {
4949
renderMonth() {
5050
return (
5151
<div className={styles.month}>
52-
<a href='javascript:;' role='button' onClick={this.handlePrev.bind(this)} />
53-
<a href='javascript:;' role='button' onClick={this.handleNext.bind(this)} />
52+
<button type='button' onClick={this.handlePrev.bind(this)} />
53+
<button type='button' onClick={this.handleNext.bind(this)} />
5454
<div>{getMonth(this.state.currentMonth.getMonth()) + ' ' + this.state.currentMonth.getFullYear()}</div>
5555
</div>
5656
);
@@ -86,7 +86,7 @@ export default class Calendar extends React.Component {
8686
new Date(Date.UTC(this.state.currentMonth.getFullYear(), this.state.currentMonth.getMonth(), i))
8787
);
8888
labels.push(
89-
<a href='javascript:;' role='button' key={'day' + i} className={className} onClick={onChange}>{i}</a>
89+
<button type='button' key={'day' + i} className={className} onClick={onChange}>{i}</button>
9090
);
9191
}
9292
let classes = [styles.days];

src/components/Calendar/Calendar.scss

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@
1717
.month {
1818
margin-bottom: 10px;
1919

20-
a {
20+
button {
21+
@include buttonReset($border: 1px solid $blue);
2122
position: relative;
2223
display: inline-block;
2324
width: 14px;
2425
height: 14px;
2526
border-radius: 100%;
26-
border: 1px solid $blue;
2727
opacity: 0.5;
2828
margin: 0 6px;
2929

@@ -94,8 +94,8 @@
9494
}
9595

9696
.days {
97-
span, a {
98-
@include DosisFont;
97+
span, button {
98+
@include buttonReset;
9999
display: inline-block;
100100
vertical-align: bottom;
101101
width: 26px;
@@ -122,13 +122,13 @@
122122
background: $darkBlue;
123123
}
124124

125-
.selected ~ a {
125+
.selected ~ button {
126126
background: white;
127127
}
128128
}
129129

130130
.shadeAfter {
131-
.selected ~ a {
131+
.selected ~ button {
132132
background: #efeff1;
133133
}
134134
}

src/components/CascadingView/CascadingView.react.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,11 @@ export default class CascadingView extends React.Component {
2020

2121
render() {
2222
let { content, className, children, style } = this.props;
23-
let expander = <a
24-
href='javascript:;'
25-
role='button'
26-
className={styles.right}>
23+
let expander = <button
24+
type='button'
25+
className={[styles.arrow, styles.right].join(' ')}>
2726
<div className={[baseStyles.center, this.state.expanded ? styles.expanded : styles.collapsed].join(' ') } />
28-
</a>;
27+
</button>;
2928
let childrenContainer = this.state.expanded ? (<div className={styles.childrenContainer}>
3029
<div className={styles.children}>{children}</div>
3130
</div>) : null;

src/components/CascadingView/CascadingView.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@ $arrowColor: #343445;
2727
padding: 0;
2828
}
2929

30+
.arrow {
31+
@include buttonReset;
32+
}
33+
3034
.expanded {
3135
@include arrow('down', 12px, 10px, $arrowColor);
3236
content: '';

src/components/DataBrowserHeaderBar/DataBrowserHeaderBar.react.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,13 +74,12 @@ export default class DataBrowserHeaderBar extends React.Component {
7474
elements.push(
7575
readonly || preventSchemaEdits ? null : (
7676
<div key='add' className={styles.addColumn} style={finalStyle}>
77-
<a
78-
href='javascript:;'
79-
role='button'
77+
<button
78+
type='button'
8079
className={styles.addColumnButton}
8180
onClick={onAddColumn}>
8281
Add a new column
83-
</a>
82+
</button>
8483
</div>
8584
)
8685
);

src/components/DataBrowserHeaderBar/DataBrowserHeaderBar.scss

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,8 @@
3333
}
3434

3535
.addColumnButton {
36-
@include DosisFont;
36+
@include buttonReset($bg: #343445);
3737
display: inline-block;
38-
background: #343445;
3938
height: 20px;
4039
width: 130px;
4140
text-align: center;

0 commit comments

Comments
 (0)