-
Notifications
You must be signed in to change notification settings - Fork 21
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
Use more accessible visual elements instead of buttons #231
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -75,3 +75,9 @@ | |
display: none; | ||
} | ||
} | ||
|
||
a.try_examples_button { | ||
text-decoration: none; | ||
display: inline-block; | ||
cursor: pointer; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -143,9 +143,10 @@ def __init__( | |
|
||
def html(self): | ||
return ( | ||
'<button class="try_examples_button" ' | ||
f"onclick=\"window.open('{self.lab_src}')\">" | ||
f"{self.button_text}</button>" | ||
f'<a href="{self.lab_src}" ' | ||
'target="_blank" rel="noopener noreferrer" ' | ||
'class="try_examples_button" style="text-decoration: none; display: inline-block; color: inherit;">' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Aren't these styles duplicates of the stylesheet? I think styling them via |
||
f"{self.button_text}</a>" | ||
) | ||
|
||
|
||
|
@@ -322,9 +323,10 @@ def __init__( | |
|
||
def html(self): | ||
return ( | ||
'<button class="try_examples_button" ' | ||
f"onclick=\"window.open('{self.lab_src}')\">" | ||
f"{self.button_text}</button>" | ||
f'<a href="{self.lab_src}" ' | ||
'target="_blank" rel="noopener noreferrer" ' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not entirely sure why you need Generally speaking The general idea behind both In any case, this is a change that should be in a separate pull request because it's not really relevant to the other changes in this pull request, and it changes the existing behavior. |
||
'class="try_examples_button" style="text-decoration: none; display: inline-block; color: inherit;">' | ||
f"{self.button_text}</a>" | ||
) | ||
|
||
|
||
|
@@ -675,17 +677,23 @@ def run(self): | |
|
||
# Button with the onclick event to swap embedded notebook back to examples. | ||
go_back_button_html = ( | ||
'<button class="try_examples_button" ' | ||
f"onclick=\"window.tryExamplesHideIframe('{examples_div_id}'," | ||
f"'{iframe_parent_div_id}')\">" | ||
"Go Back</button>" | ||
Comment on lines
-678
to
-681
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I see no reason to change this element. It really is a button; it's not link, it's not taking you to a new URL. Generally speaking, you should only use the |
||
'<a href="#" ' | ||
'role="button" ' | ||
'aria-label="Return to original content and close the examples frame" ' | ||
f'onclick="window.tryExamplesHideIframe(\'{examples_div_id}\', ' | ||
f'\'{iframe_parent_div_id}\'); return false;" ' | ||
'class="try_examples_button" ' | ||
'style="text-decoration: none; display: inline-block;">' | ||
'Go Back</a>' | ||
) | ||
|
||
|
||
full_screen_button_html = ( | ||
'<button class="try_examples_button" ' | ||
f"onclick=\"window.openInNewTab('{examples_div_id}'," | ||
f"'{iframe_parent_div_id}')\">" | ||
"Open In Tab</button>" | ||
f'<a href="{iframe_src}" ' | ||
'target="_blank" rel="noopener noreferrer" ' | ||
'class="try_examples_button" ' | ||
'style="text-decoration: none; display: inline-block;">' | ||
"Open In Tab</a>" | ||
) | ||
|
||
# Button with the onclick event to swap examples with embedded notebook. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this CSS needed?