Lab 17 - Git Revert Undo
Use the WAVE tool to asses the accessibility of a web page and then practice git undo when things go awry.
Categories:
7 minute read
Learning Objectives
- pronounce “awry” as “uh-rye”
- executing the WAVE tool
- reading and understanding the WAVE tool output
- correcting issues identified by the WAVE tool
- committing changes to a git repository
- using
git revert
to undo a commit
Introduction
The WAVE tool is designed to facilitate the evaluation of web content for accessibility issues. It is a browser extension that can be used to identify potential issues in a web page. The tool provides a visual representation of the page with icons that indicate potential issues. Clicking on an icon will provide more information about the issue and suggestions for how to correct it.
Gitting Started
In this week’s prep you already checked that you have a few global git configuration options set (i.e. user.name
and user.email
), but it’s possible you’d enjoy having a few more in place. Here’s an excerpt from mine in case you’d like to have any of those options as well.
- Begin with the starting code provided by your instructor (e.g. from an assignment in your learning management system) or else in the these go to eleven repo (the best way to begin with such code is to
clone
it to your computer using the steps below).- open a terminal window
- navigate to a place where you’d like to work,
- e.g.
cd $HOME/Desktop
- if you’re on Windows and that failed, try this instead
cd $HOME/OneDrive/Desktop
- if you’re on Windows and that failed, try this instead
- it doesn’t matter exactly where you work as long as you know where it is.
- e.g.
- clone the git repository (if you first created a repository on github via github classroom assignment or instantiating the linked template repository, get the URL for cloning from that git repo you newly created and use it in place of the
git@github...
part in the following command), e.g.git clone git@github.com:hcientist/these-go-to-eleven.git
- if you now
ls
you should see that you have a directory namedthese-go-to-eleven
- navigate into this cloned repo by doing
cd these-go-to-eleven
- open the cloned repo in VS Code by typing
code .
- add your name to the
Contributors
section of theREADME.md
file.- open the
README.md
file - notice that even though the existing entries both begin with
1.
, they are rendered in the browser as consecutive increasing numbers. This is because the README file is written in a syntax called markdown. That markdown is being rendered as HTML, and the browser is interpreting the numbers as an ordered list. - add your name to the list, following the existing pattern
- save the file
- open the
- create a “restore point” including your changes by committing them to the local git repository
- in the terminal window, type
git status
to see what files have been changed - type
git add README.md
to stage the changes to the README file - type
git commit -m "added my name to the contributors list"
to commit the changes
- in the terminal window, type
- backup your changes by pushing them to the
remote
git repository- type
git push
to push the changes to the remote repository
- type
WAVE Evaluation
- Launch the VSCode Live Server and view the provided index.html file in your browser.
- enjoy your new drumkit
- open the WAVE tool by clicking on the WAVE icon in the browser toolbar
- click on the icons in the WAVE tool to view the issues identified by the tool
Correcting Document Structure Issues
- You should see
0 errors
if you run the WAVE tool against the providedindex.html
file. - However you should see several alerts, including these two:
No heading structure
No page regions
- Correct the first issue by adding an
h1
element to the page.- open the
index.html
file - add an
h1
element to the page as the first child of the body, give the element some text, you can choose what you want, but I choseThese go to 11...
- save the file
- refresh the page in the browser
- Confirm that the
No heading structure
alert is no longer present.- (optionally, you could create a “restore point” at this stage by committing your changes to the local git repository)
- open the
- Correct the second issue by adding a
main
element to the page.- wrap the current contents of the html
body
element in amain
element. - save the file
- refresh the page in the browser
- Confirm that the
No page regions
alert is no longer present.
- wrap the current contents of the html
- Create a “restore point” at this stage by committing your changes to the local git repository
- in the terminal window, type
git status
to see what files have been changed (it should only list theindex.html
file) - type
git add index.html
to stage the changes to the index.html file - type
git commit -m "fixed 2 WAVE alerts related to document structure"
to commit the changes
- in the terminal window, type
Correcting(?) Issues Related to Audio
- In the WAVE tool, you still see no errors, and should now only see the 9 alerts related to HTML5 audio elements.
- improve the accessibility of the page by adding transcripts to the audio elements.
- open the
index.html
file - in the content of each of the (9)
audio
elements, add 2 links: one to the transcript of the audio, and one to the audio itself (the transcript files do not actually exist yet).- e.g. change
to
<audio data-key="65" src="sounds/clap.wav"></audio>
<audio data-key="65" src="sounds/clap.wav"> <a href="sounds/clap.wav" download>Download the clap sound effect</a> or <a href="clap.txt" download="clap.txt">its transcript</a> </audio>
- e.g. change
- save the file
- open the
- Create a “restore point” at this stage by committing your changes to the local git repository
- in the terminal window, type
git status
to see what files have been changed (it should only list theindex.html
file) - type
git add index.html
to stage the changes to the index.html file - type
git commit -m "added transcripts to audio elements"
to commit the changes
- in the terminal window, type
Correcting “Corrections” 😒
- In the WAVE tool, what was the impact of adding the transcripts to the audio elements?
- not much. The alerts are still there. This doesn’t necessarily mean you failed, but in this case, it seems a bit unclear that the general recommendation applies to our scenario. as these audio files are only sound effects and as each is already labeled with a textual description, it’s not clear that a transcript is helping very much.
- that being said, the inner content of elements like
audio
andvideo
can be used to provide fallback content for browsers that don’t support the media type or for users who can’t access the media for some reason. So, it’s not a bad idea to provide a link to a transcript/the audio file to download, but it’s not clear that it’s necessary in this case.
- that being said, the inner content of elements like
- not much. The alerts are still there. This doesn’t necessarily mean you failed, but in this case, it seems a bit unclear that the general recommendation applies to our scenario. as these audio files are only sound effects and as each is already labeled with a textual description, it’s not clear that a transcript is helping very much.
- Undo the changes you made to the
index.html
file related to the audio elements.- in the command line, type
git log
to see the commit history. this history is displayed in reverse chronological order, with the most recent commit at the top.- the git log is typically displayed in program called a
pager
- the default pager is not well documented, it’s often
less
, but it could be one calledmore
on some systems. - when viewing the commit log in either
less
ormore
you can scroll through the log by using the arrow keys. to exit the pager, typeq
. (many othervi
keybindings would also work)
- the git log is typically displayed in program called a
- notice that the most recent commit is the one that you’d like to undo
- notice also that this most recent commit has the label
HEAD
next to it. - press
q
to exit the pager - type
git revert HEAD
to undo the most recent commit- it’s possible that you’ll be prompted to enter a commit message. if so type one and save the file.
- if you see something like the screenshot below, you’re now in a text editor called
vim
. - to enter text in
vim
, pressi
to enterinsert
mode. you should see-- INSERT --
at the bottom of the screen. type your commit message. when you’re done, pressesc
to exitinsert
mode. then type:wq
to write the file and quit the editor.
- if you see something like the screenshot below, you’re now in a text editor called
- it’s possible that you’ll be prompted to enter a commit message. if so type one and save the file.
- in the command line, type
- Submit the current state of your code according to your instructor’s instructions (e.g. by pushing to the github classroom repo).
Last modified August 11, 2024: moved a bunch of things for archival purposes (6652bbe)