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

Search bar accessibility #45

Merged
merged 4 commits into from
Nov 13, 2019
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
2 changes: 1 addition & 1 deletion src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ function App() {
<SearchBar currZip={currZip} currRange={currRange} updateZip={(newZip) => setCurrZip(newZip)} updateRange={(newRange) => setCurrRange(newRange)} events={events} updatedHover={(newHover) => setHoverEvent(newHover)} locFilt={locFilt}/>
{events === null && currZip == null &&
<div id="startLoad">
<h1 id="firstLine">SHE HAS</h1><h1 id="secondLine">EVENTS</h1><h1 id="thirdLine">FOR THAT <img src={gMark}></img></h1>
<h1 id="firstLine">SHE HAS</h1><h1 id="secondLine">EVENTS</h1><h1 id="thirdLine">FOR THAT <img src={gMark} alt=""></img></h1>
<h3 id="searchCTA">Enter your zipcode to find events near you!</h3>
</div>
}
Expand Down
26 changes: 10 additions & 16 deletions src/App.scss
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,16 @@ html, body, #root, .app {
padding-right: 9%;
}

label[for=zipInput] {
color: white;
position: fixed;
font-size: 24px;
}

[data-has-input=true] label[for=zipInput] {
color: transparent;
}

#zipInput{
height: 30%;
width: 80%;
Expand Down Expand Up @@ -212,22 +222,6 @@ html, body, #root, .app {

}




::placeholder { /* Chrome, Firefox, Opera, Safari 10.1+ */
color: white;
opacity: 1; /* Firefox */
}

:-ms-input-placeholder { /* Internet Explorer 10-11 */
color: white;
}

::-ms-input-placeholder { /* Microsoft Edge */
color: white;
}

.eventList{
background-color: white;
height: 500px;
Expand Down
11 changes: 5 additions & 6 deletions src/SearchBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,12 @@ import locateImage from './img/icon_512x512.png';


export function SearchBar(props){
const[input, setInput] = useState(props.currZip);
const [input, setInput] = useState(props.currZip || '');
const[rangeInput, setRangeInput] = useState(props.currRange);

function onlySetNumbers(event){
let baseValue = event.target.value;
let replacedVal = baseValue.replace(/\D*/g, '')
//console.log(`baseValue: ${baseValue}, replacedVal: ${replacedVal}`);
setInput(replacedVal)
}

Expand Down Expand Up @@ -54,15 +53,15 @@ export function SearchBar(props){
History.push(window.location.pathname+'?zip='+input);
}


return(
<div className={(props.events != null ? "searchBar activeList" : "searchBar") + (isMobile ? " mobileSearch" : "")}>
<div className="userInput">
<form onSubmit={onSubmit} id="zipForm">
<input type="text" id="zipInput" value={input} onChange={onlySetNumbers} placeholder="ZIP" required minLength="5" maxLength="5"></input>
<form onSubmit={onSubmit} id="zipForm" data-has-input={!!input.length}>
<label for="zipInput">ZIP</label>
<input type="text" id="zipInput" value={input} onInput={onlySetNumbers} required minLength="5" maxLength="5"></input>
<button id="submitZip" onClick={onSubmit}>GO</button>
</form>
<button id="locateMe" onClick={geolocate}><img src={locateImage}></img></button>
<button id="locateMe" onClick={geolocate}><img src={locateImage} alt="Use my location"></img></button>
</div>

{ props.events !== null &&
Expand Down