Skip to content

Commit 2baf046

Browse files
authored
Merge pull request #2150 from ember-learn/merge-master
Merge master into gjs branch
2 parents 7257532 + 8f03818 commit 2baf046

File tree

249 files changed

+25023
-16
lines changed

Some content is hidden

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

249 files changed

+25023
-16
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# compiled output
22
/dist/
33
/declarations/
4+
/tmp/
45

56
# dependencies
67
/node_modules/

guides/release/tutorial/part-1/component-basics.md

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -58,16 +58,15 @@ When invoking a component, Ember will replace the component tag with the content
5858

5959
Let's try it out by editing the index template:
6060

61-
```handlebars { data-filename="app/templates/index.hbs" data-diff="-1,-2,+3,+7,-8" }
61+
```handlebars { data-filename="app/templates/index.hbs" data-diff="-1,-2,+3,-7,+8" }
6262
<div class="jumbo">
6363
<div class="right tomster"></div>
6464
<Jumbo>
6565
<h2>Welcome to Super Rentals!</h2>
6666
<p>We hope you find exactly what you're looking for in a place to stay.</p>
6767
<LinkTo @route="about" class="button">About Us</LinkTo>
68-
</Jumbo>
6968
</div>
70-
69+
</Jumbo>
7170
```
7271

7372
## Refactoring Existing Code
@@ -80,7 +79,7 @@ After saving the changes, your page should automatically reload, and, _voilà_..
8079

8180
Let's do the same for our other two pages as well.
8281

83-
```handlebars { data-filename="app/templates/about.hbs" data-diff="-1,-2,+3,+11,-12" }
82+
```handlebars { data-filename="app/templates/about.hbs" data-diff="-1,-2,+3,-11,+12" }
8483
<div class="jumbo">
8584
<div class="right tomster"></div>
8685
<Jumbo>
@@ -91,11 +90,11 @@ Let's do the same for our other two pages as well.
9190
AND building Ember applications.
9291
</p>
9392
<LinkTo @route="contact" class="button">Contact Us</LinkTo>
94-
</Jumbo>
9593
</div>
94+
</Jumbo>
9695
```
9796

98-
```handlebars { data-filename="app/templates/contact.hbs" data-diff="-1,-2,+3,+19,-20" }
97+
```handlebars { data-filename="app/templates/contact.hbs" data-diff="-1,-2,+3,-19,+20" }
9998
<div class="jumbo">
10099
<div class="right tomster"></div>
101100
<Jumbo>
@@ -114,8 +113,8 @@ Let's do the same for our other two pages as well.
114113
115114
</address>
116115
<LinkTo @route="about" class="button">About</LinkTo>
117-
</Jumbo>
118116
</div>
117+
</Jumbo>
119118
```
120119

121120
After saving, everything should look exactly the same as before, and all the tests should still pass. Very nice!

guides/release/tutorial/part-1/orientation.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ To verify that your installation was successful, run:
2424

2525
```shell
2626
$ ember --version
27-
ember-cli: 6.4.0
27+
ember-cli: 6.7.0
2828
node: 18.20.8
2929
os: linux x64
3030
```
@@ -37,8 +37,8 @@ We can create a new project using Ember CLI's `new` command. It follows the patt
3737

3838
```shell
3939
$ ember new super-rentals --lang en
40-
installing app
41-
Ember CLI v6.4.0
40+
installing classic-build-app-blueprint
41+
@ember-tooling/classic-build-app-blueprint v6.7.0
4242

4343
Creating a new Ember app in /home/runner/work/super-rentals-tutorial/super-rentals-tutorial/dist/code/super-rentals:
4444
create .editorconfig
@@ -159,7 +159,7 @@ super-rentals
159159
├── package-lock.json
160160
└── testem.js
161161
162-
16 directories, 37 files
162+
17 directories, 37 files
163163
```
164164

165165
We'll learn about the purposes of these files and folders as we go. For now, just know that we'll spend most of our time working within the `app` folder.

guides/release/tutorial/part-1/working-with-data.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ public
243243
│ └── teaching-tomster.png
244244
└── robots.txt
245245
246-
4 directories, 6 files
246+
5 directories, 6 files
247247
```
248248

249249
You can verify that everything is working correctly by navigating to `http://localhost:4200/api/rentals.json`.

guides/release/tutorial/part-2/ember-data.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -346,6 +346,19 @@ setBuildURLConfig({
346346
namespace: 'api',
347347
});
348348

349+
/* This is to account for a deprecation that shipped in ember-cli 6.4
350+
with ember-data v5.6 which needs a blueprint update to avoid the
351+
deprecation that is otherwise irrelevant for tutorial purposes.
352+
*/
353+
import { registerDeprecationHandler } from '@ember/debug';
354+
registerDeprecationHandler((message, options, next) => {
355+
if (message.includes('Using WarpDrive with EmberJS requires')) {
356+
return;
357+
} else {
358+
next(message, options);
359+
}
360+
});
361+
349362
if (macroCondition(isDevelopingApp())) {
350363
importSync('./deprecation-workflow');
351364
}
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
In this section, you will learn about the configurations and libraries that affect an entire application's accessibility.
2+
3+
## Lang Attribute
4+
5+
Declaring the language of the HTML document allows users to better understand your content.
6+
7+
> Both assistive technologies and conventional user agents can render text more accurately when the language of the Web page is identified. Screen readers can load the correct pronunciation rules. Visual browsers can display characters and scripts correctly. Media players can show captions correctly. As a result, users with disabilities will be better able to understand the content.
8+
> [WCAG Success Criterion 3.1.1: Intent](https://www.w3.org/WAI/WCAG21/Understanding/language-of-page.html#intent)
9+
10+
A primary language should be defined on the `<html>` element's `lang` attribute. For new apps, you can use the `--lang` option on the `ember new` command to set the language for a new application.
11+
12+
```bash
13+
ember new mon-app --lang fr
14+
```
15+
16+
This command will create your application with French defined as the primary language
17+
on the `<html>` element's `lang` attribute.
18+
19+
For existing Ember apps, a developer may edit the `index.html` file or leverage [ember-intl](https://github.com/ember-intl/ember-intl).
20+
21+
The `html` element may not have multiple `lang` _values_. If an element contains content in a language different from the primary, then you can provide the element its own `lang` attribute.
22+
23+
![For example, the HTML tag may have a lang of "es" while a paragraph may have a lang of "en"](/images/accessibility/application-considerations/lang.png)
24+
25+
<div class="cta">
26+
<div class="cta-note">
27+
<div class="cta-note-body">
28+
<div class="cta-note-heading">Zoey says...</div>
29+
<div class="cta-note-message">
30+
<p>
31+
To learn more about the lang attribute and how to use it: <a href="https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/lang">https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/lang</a>. Unsure which language subtag to use? Try <a href="https://r12a.github.io/app-subtags/">the Language Subtag Lookup tool</a>.
32+
</p>
33+
</div>
34+
</div>
35+
<img src="/images/mascots/zoey.png" role="presentation" alt="">
36+
</div>
37+
</div>
38+
39+
## Accessibility addons
40+
41+
Any addon that will provide UI elements to the application should be evaluated for accessibility before use.
42+
43+
There are some existing Ember addons that may help you make your app more accessible. Each addon should be evaluated for its own usefulness and merit- you may find in some instances, that it would be better to implement the ideas presented in the addon in your own application.
44+
45+
Here are some examples of accessibility-focused addons created by many people throughout the Ember community:
46+
47+
- [ember-a11y-landmarks](https://github.com/ember-a11y/ember-a11y-landmarks) - Ember addon to help with landmark roles for better accessibility
48+
- [ember-component-focus](https://github.com/ember-a11y/ember-component-focus) - A mixin for adding methods to your Ember components that help you manage the currently focused element.
49+
- [ember-steps](https://github.com/rwjblue/ember-steps) - Declarative create wizards, tabbed UIs, and more
50+
- [ember-page-title](https://github.com/tim-evans/ember-page-title) - Page title management for Ember.js Apps
51+
- [ember-self-focused](https://github.com/linkedin/self-focused/tree/master/packages/ember-self-focused) - Focus on route on transition
52+
- [ember-keyboard](https://github.com/patience-tema-baron/ember-keyboard) - An Ember.js addon for the painless support of keyboard events
53+
- [ember-a11y-testing](https://github.com/ember-a11y/ember-a11y-testing) - A suite of accessibility tests that can be run within the Ember testing framework
54+
- [a11y-announcer](https://github.com/ember-a11y/a11y-announcer) - An accessible ember route change announcer
55+
- [ember-template-lint](https://github.com/ember-template-lint/ember-template-lint) - linter for Ember templates
56+
![Template Linting Preview](/images/accessibility/application-considerations/template-lint.png)
57+
58+
While there are quite a few moving parts, here's a cheat sheet to get you started: [Accessibility Cheat Sheet](https://moritzgiessmann.de/accessibility-cheatsheet/)
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
When crafting an accessible component, the first and most important thing is that the component should render valid HTML.
2+
3+
Both the HTML and ARIA specifications have been written in a way that make them work together. Semantic HTML provides the necessary _context_ to screen readers.
4+
5+
Browsers have implemented the spec in a way that provides functionality for free.
6+
For example, consider this code sample:
7+
8+
```html
9+
<button type="submit">Submit Form</button>
10+
```
11+
12+
Here is what would be provided by the browser that the developer would otherwise need to provide:
13+
14+
- keyboard interactions on interactive elements (i.e., using the `ENTER` key to activate a `<button>` element)
15+
- a machine-readable name
16+
- a place in the `TAB` order of the page
17+
- the intrinsic role of button
18+
19+
If the interactive element would be written another way, such as:
20+
21+
```html
22+
<div>Submit Form</div>
23+
```
24+
25+
The developer would need to write the following additional code:
26+
27+
- add the role of button (`role="button"`)
28+
- add the button to the tab order (`tabindex="0"`)
29+
- add the keyboard functionality (a JavaScript function to activate the associated action when the `ENTER` key is pressed)
30+
31+
This is just one example of how developers can use HTML's built in features to improve accessibility and reduce the need for custom code. Read more here: ["Just use a button"](https://developer.paciellogroup.com/blog/2011/04/html5-accessibility-chops-just-use-a-button/).
32+
33+
## Focus management in components
34+
35+
Focus is one of the main ways a component can communicate with screen readers.
36+
37+
For example, when you hit tab on a page or click on a form field, a blue border usually appears around the element. This kind of behavior is part of focus.
38+
Developers can use JavaScript to control the focus in their apps, enabling keyboard navigation and usability by screen readers.
39+
For example, if there is a button that launches a modal with interactive elements in it, that button's click handler needs to contain code that brings focus to the new content.
40+
41+
This article is a good launching point for learning more about focus: [Keyboard accessibility](https://webaim.org/techniques/keyboard/)
42+
43+
Here are some other tips to get you started:
44+
45+
- There is a difference between browse mode and focus mode in screen readers- see ["Focus Please"](https://codepen.io/melsumner/live/ZJeYoP).
46+
- Focus should return from whence it came- for example, if a `<button>` element opens a modal, the focus should then be returned to that same trigger button once the modal is closed.
47+
- Note: `role="presentation"` or `aria-hidden="true"` should not be used on a focusable element.
48+
49+
50+
## Accessible name
51+
52+
All interactive elements must have an accessible name. But what does that mean, exactly?
53+
54+
Because the code that is written must be readable by other machines (assistive tech like screen readers, for example), there is documentation about how this accessible name is determined: [Accessible Name and Description Computation](https://www.w3.org/TR/accname-1.1/).
55+
56+
However, the most common methods for providing accessible names can be reviewed here.
57+
58+
### Adding a label to an input element
59+
60+
Every `<input>` element should have an associated `<label>` element. To do this, the `<input>` element's `id` attribute value should be the same as the `for` attribute value on the `<label>`. Ember has a built-in `unique-id` helper that can generate unique ids that you can use like this:
61+
62+
![Separate input and label elements with a connection established by matching for and id attributes](/images/accessibility/component-considerations/input-for-id.png)
63+
64+
```html
65+
{{#let (unique-id) as |id|}}
66+
<label for={{id}}>Name:</label>
67+
<input id={{id}} name="name" value="" type="text" />
68+
{{/let}}
69+
```
70+
71+
It is also valid to wrap the `<label>` element around the `<input />` element:
72+
73+
![A child input element nested within a parent label element without any for and id attributes](/images/accessibility/component-considerations/input-nested.png)
74+
75+
```html
76+
<label>Name:
77+
<input name="name" value="" type="text" />
78+
</label>
79+
```
80+
81+
However, this option can be a little harder to apply styles to, so both should be tested before determining which approach to use.
82+
83+
<div class="cta">
84+
<div class="cta-note">
85+
<div class="cta-note-body">
86+
<div class="cta-note-heading">Zoey says...</div>
87+
<div class="cta-note-message">
88+
To dig deeper into accessible input patterns in Ember check out the <a href="https://emberjs-1.gitbook.io/ember-component-patterns/form-components/input">ember-component-patterns article on Input Fields</a>.
89+
</div>
90+
</div>
91+
<img src="/images/mascots/zoey.png" role="presentation" alt="">
92+
</div>
93+
</div>
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
Ember provides a few ways to help developers more easily produce accessible applications, and this section of the guides will more explicitly assist with that.
2+
3+
![Ember Loves Accessibility](/images/accessibility/index/a11y-mascots.png)
4+
5+
Accessibility should be considered at the start of a project, whether that project has named accessibility an explicit goal or not. Since no one can predict anyone else's future (including whether or not they will need assistive technology at some point), and because in many places around the world it is legally required to make websites digitally accessible, accessibility should be thought about in the same way as performance- a necessity for any web-based product.
6+
7+
Additionally, it causes less churn to decide to implement basic accessibility considerations at the start of the project, than trying to add it on later or pivoting mid-project. Semantic HTML doesn't take any additional time to write than non-semantic markup, provides a lower cognitive burden for development, typically produces less markup which will help an application be more performant, and is better for SEO.
8+
9+
10+
## Accessibility Strategy
11+
12+
Digital accessibility regulations vary from country to country, but most at least point to the [WAI-ARIA](https://www.w3.org/WAI/) specification for compliance.
13+
14+
"100% accessible"- what does that mean? From a practical perspective, accessibility really looks more like 90% coding to the spec and 10% filing browser bugs (or keeping track of existing browser bugs). Keep in mind that if a workaround for a browser bug is implemented, an internal tracking issue in the product backlog should be also filed so as to provide the reminder to follow up on browser bugs at a later date.
15+
16+
Creating a sensible plan for your product up front can save a great deal of stress down the road.
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
These accessibility learning resources will provide additional support to the developer looking to improve the quality of the code they write.
2+
3+
- [MDN Web Docs: Accessibility](https://developer.mozilla.org/en-US/docs/Learn/Accessibility)
4+
- [Using ARIA:](https://www.w3.org/TR/using-aria/) a practical guide for developers on how to add accessibility information to HTML elements
5+
- [Web Content Accessibility Guidelines(WCAG) 2.1](https://www.w3.org/TR/WCAG21/)
6+
- [Accessible Rich Internet Applications (ARIA) 1.1](https://www.w3.org/TR/wai-aria-1.1/)
7+
- [How to meet WCAG (Quick Reference)](https://www.w3.org/WAI/WCAG21/quickref/)
8+
9+
10+
## Practical Resources
11+
12+
- [Accessibility Insights](https://accessibilityinsights.io/)- Use FastPass to find common, high-impact issues
13+
- [aXe extension for Chrome](https://chrome.google.com/webstore/detail/axe/lhdoppojpmngadmnindnejefpokejbdd)
14+
- [Accessibility Support](https://a11ysupport.io/)- Find out if your code will work with assistive tech
15+
- [How and where to report accessibility bugs](https://www.digitala11y.com/how-where-to-report-accessibility-bugs/)
16+
17+
18+
### Design
19+
20+
- [ColorSafe](http://colorsafe.co/)- Empowering designers with beautiful and accessible color palettes based on WCAG Guidelines of text and background contrast ratios
21+
- [Accessible Color Palette Builder](https://toolness.github.io/accessible-color-matrix/)
22+
23+
24+
### Writing
25+
26+
- [Plain Language](https://plainlanguage.gov/) - Learn how to write in a way that makes it easier for people to read and understand.
27+
28+
29+
### Other Useful Articles
30+
31+
- [The difference between keyboard and screen reader navigation](https://tink.uk/the-difference-between-keyboard-and-screen-reader-navigation/)

0 commit comments

Comments
 (0)