-
Notifications
You must be signed in to change notification settings - Fork 397
Add fullscreen button to examples #2274
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
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 |
---|---|---|
|
@@ -6,9 +6,10 @@ | |
{% set parent_idx = total_ancestors - 1 %} | ||
{% set category = get_section(path=page.ancestors | nth(n=parent_idx)) %} | ||
<h2 class="example__title">{{ category.title }} / {{ page.title }}</h2> | ||
<a class="example__back" href="{% block examples_url %}{% endblock examples_url %}"><i class="icon icon--chevron-left"></i> Back to examples</a> | ||
<a class="example__github" | ||
href="https://github.com/bevyengine/bevy/blob/latest/{{ page.extra.github_code_path }}"> | ||
<a class="example__back" href="{% block examples_url %}{% endblock examples_url %}"><i | ||
class="icon icon--chevron-left"></i> Back to examples</a> | ||
<a id="fullscreen-button" class="example__fullscreen"><i class="icon icon--fullscreen"></i></a> | ||
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. Immediate concern is that this is an improper use of the anchor element. Anchors are meant for navigation to other places, whether they be to files, other web pages, another section in the same page, or even to someones email address. For an action like initializing fullscreen we should be using a button element in an anchor elements stead. Why this matters is accessibility and semantics as text to speech tools will have little context with this anchor that is not an actual anchor, and so any accessibility functions with regards to ARIA and such you get with using the semantic element properly is lost.
See this for more on button accessibility: https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/button#accessibility |
||
<a class="example__github" href="https://github.com/bevyengine/bevy/blob/latest/{{ page.extra.github_code_path }}"> | ||
<i class="icon icon--github"></i> View in GitHub | ||
</a> | ||
</div> | ||
|
@@ -30,9 +31,9 @@ <h2 class="example__title">{{ category.title }} / {{ page.title }}</h2> | |
</aside> | ||
</div> | ||
{% if page.content %} | ||
<div class="example__explanation media-content"> | ||
{{ page.content | safe }} | ||
</div> | ||
<div class="example__explanation media-content"> | ||
{{ page.content | safe }} | ||
</div> | ||
{% endif %} | ||
<div class="example__code-tabs tabs"> | ||
{% set filename = page.extra.code_path | split(pat="/") | last %} | ||
|
@@ -45,17 +46,17 @@ <h2 class="example__title">{{ category.title }} / {{ page.title }}</h2> | |
{{ code_md | markdown(inline=true) | safe }} | ||
</div> | ||
</div> | ||
|
||
{% for shader in page.extra.shader_code_paths %} | ||
<input class="tabs__radio" tabindex="1" name="tabs" type="radio" id="tab{{ loop.index }}"> | ||
<label class="tabs__label" for="tab{{ loop.index }}"><code>{{ shader }}</code></label> | ||
<div class="tabs__panel" tabindex="1"> | ||
<div class="example__code media-content"> | ||
{% set code = load_data(path="static/assets/examples/" ~ shader) %} | ||
{% set code_md = "```wgsl" ~ newline ~ code ~ "```" %} | ||
{{ code_md | markdown(inline=true) | safe }} | ||
</div> | ||
<input class="tabs__radio" tabindex="1" name="tabs" type="radio" id="tab{{ loop.index }}"> | ||
<label class="tabs__label" for="tab{{ loop.index }}"><code>{{ shader }}</code></label> | ||
<div class="tabs__panel" tabindex="1"> | ||
<div class="example__code media-content"> | ||
{% set code = load_data(path="static/assets/examples/" ~ shader) %} | ||
{% set code_md = "```wgsl" ~ newline ~ code ~ "```" %} | ||
{{ code_md | markdown(inline=true) | safe }} | ||
</div> | ||
</div> | ||
{% endfor %} | ||
</div> | ||
</div> | ||
|
@@ -134,5 +135,6 @@ <h2 class="example__title">{{ category.title }} / {{ page.title }}</h2> | |
throw error; | ||
} | ||
}); | ||
document.getElementById("fullscreen-button").addEventListener("click", () => canvasEl.requestFullscreen()); | ||
</script> | ||
{% endblock content %} |
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.
Portrait Mode Phone Screenshot
Widescreen Computer Screenshot
In the screenshots above, the size of the fullscreen icon seems way to big on mobile, and maybe in an awkward place and or too big as well on PC. Not sure the exact solution, but it did pop out at me.