Skip to content

Commit f85d2e2

Browse files
Add extensions additional tutorials links to learnsidebar (#41242)
* Add extensions additional tutorials links to learnsidebar * Fixes for review comments * Update files/en-us/web/performance/index.md Co-authored-by: Hamish Willee <[email protected]> * Update files/en-us/learn_web_development/extensions/forms/index.md Co-authored-by: Hamish Willee <[email protected]> * Update slug and title, fix linkage * Apply suggestion from @hamishwillee --------- Co-authored-by: Hamish Willee <[email protected]>
1 parent 4ad3c4e commit f85d2e2

File tree

16 files changed

+99
-42
lines changed

16 files changed

+99
-42
lines changed

files/en-us/_redirects.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5596,7 +5596,7 @@
55965596
/en-US/docs/Learn/Performance/Perceived_performance /en-US/docs/Learn_web_development/Extensions/Performance/Perceived_performance
55975597
/en-US/docs/Learn/Performance/Populating_the_page:_how_browsers_work /en-US/docs/Web/Performance/Guides/How_browsers_work
55985598
/en-US/docs/Learn/Performance/Understanding_latency /en-US/docs/Web/Performance/Guides/Understanding_latency
5599-
/en-US/docs/Learn/Performance/Web_Performance_Basics /en-US/docs/Learn_web_development/Extensions/Performance/Web_Performance_Basics
5599+
/en-US/docs/Learn/Performance/Web_Performance_Basics /en-US/docs/Learn_web_development/Extensions/Performance/Best_practices
56005600
/en-US/docs/Learn/Performance/Web_performance_overview /en-US/docs/Learn_web_development/Extensions/Performance/What_is_web_performance
56015601
/en-US/docs/Learn/Performance/What_is_web_performance /en-US/docs/Learn_web_development/Extensions/Performance/What_is_web_performance
56025602
/en-US/docs/Learn/Performance/business_case_for_performance /en-US/docs/Learn_web_development/Extensions/Performance/business_case_for_performance
@@ -5842,6 +5842,8 @@
58425842
/en-US/docs/Learn_web_development/Extensions/Forms/Test_your_skills:_HTML5_controls /en-US/docs/Learn_web_development/Extensions/Forms
58435843
/en-US/docs/Learn_web_development/Extensions/Forms/Test_your_skills:_Other_controls /en-US/docs/Learn_web_development/Extensions/Forms
58445844
/en-US/docs/Learn_web_development/Extensions/Forms/Test_your_skills:_Styling_basics /en-US/docs/Learn_web_development/Extensions/Forms
5845+
/en-US/docs/Learn_web_development/Extensions/Performance/Resources /en-US/docs/Learn_web_development/Extensions/Performance/Best_practices
5846+
/en-US/docs/Learn_web_development/Extensions/Performance/Web_Performance_Basics /en-US/docs/Learn_web_development/Extensions/Performance/Best_practices
58455847
/en-US/docs/Learn_web_development/Extensions/Security_privacy /en-US/docs/Web/Security
58465848
/en-US/docs/Learn_web_development/Extensions/Transform_animate /en-US/docs/Learn_web_development/Extensions
58475849
/en-US/docs/Learn_web_development/Getting_started/Basic_setup /en-US/docs/Learn_web_development/Getting_started/Environment_setup/Installing_software

files/en-us/_wikihistory.json

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8781,6 +8781,17 @@
87818781
"malchata"
87828782
]
87838783
},
8784+
"Learn_web_development/Extensions/Performance/Best_practices": {
8785+
"modified": "2020-07-16T22:40:42.703Z",
8786+
"contributors": [
8787+
"Sheppy",
8788+
"estelle",
8789+
"jdmerriman",
8790+
"verde79",
8791+
"PickensC",
8792+
"santoshjoseph99"
8793+
]
8794+
},
87848795
"Learn_web_development/Extensions/Performance/CSS": {
87858796
"modified": "2020-11-11T15:16:18.377Z",
87868797
"contributors": ["chrisdavidmills", "estelle"]
@@ -8820,17 +8831,6 @@
88208831
"modified": "2020-07-16T22:40:43.307Z",
88218832
"contributors": ["wilsotobianco", "estelle", "mhilko", "ottoetc"]
88228833
},
8823-
"Learn_web_development/Extensions/Performance/Web_Performance_Basics": {
8824-
"modified": "2020-07-16T22:40:42.703Z",
8825-
"contributors": [
8826-
"Sheppy",
8827-
"estelle",
8828-
"jdmerriman",
8829-
"verde79",
8830-
"PickensC",
8831-
"santoshjoseph99"
8832-
]
8833-
},
88348834
"Learn_web_development/Extensions/Performance/What_is_web_performance": {
88358835
"modified": "2020-07-16T22:40:40.542Z",
88368836
"contributors": [

files/en-us/learn_web_development/extensions/forms/how_to_build_custom_form_controls/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
---
22
title: How to build custom form controls
3+
short-title: Custom form controls
34
slug: Learn_web_development/Extensions/Forms/How_to_build_custom_form_controls
45
page-type: learn-module-chapter
56
sidebar: learnsidebar

files/en-us/learn_web_development/extensions/forms/html_forms_in_legacy_browsers/index.md

Lines changed: 34 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
---
22
title: HTML forms in legacy browsers
3+
short-title: Forms in legacy browsers
34
slug: Learn_web_development/Extensions/Forms/HTML_forms_in_legacy_browsers
45
page-type: guide
56
sidebar: learnsidebar
@@ -86,17 +87,15 @@ input[type="button"] {
8687
}
8788
```
8889

89-
### Let go of CSS
90+
### Limit styling in legacy browsers
9091

91-
One of the big issues with HTML Forms is styling form widgets with CSS. Form controls appearance is browser and operating system specific. For example, the input of color type looks different in Safari, Chrome and Firefox browser, but the color picker widget is the same in all browsers on a device as it opens up the operating system's native color picker.
92+
One of the big issues with HTML forms in legacy browsers is styling them with CSS. As covered elsewhere, you can declare {{cssxref('appearance', 'appearance: none;')}} to remove the default styles and build your own on top. However, legacy browsers are less likely than modern browsers to support the styling techniques covered earlier in the module. It might be better to just leave form controls unstyled in legacy browsers, if you need to support them. See the next section for advice on detecting support for specific input types.
9293

93-
It's generally a good idea to not alter the default appearance of form control because altering one CSS property value may alter some input types but not others. For example, if you declare `input { font-size: 2rem; }`, it will impact `number`, `date`, and `text`, but not `color` or `range`. If you alter a property, that may impact the appearance of the widget in unexpected ways. For example, `[value] { background-color: #cccccc; }` may have been used to target every {{HTMLElement("input")}} with a `value` attribute, but changing the background-color or border radius on a {{HTMLElement("meter")}} will lead to likely unexpected results that differ across browsers. You can declare {{cssxref('appearance', 'appearance: none;')}} to remove the browser styles, but that generally defeats the purpose: as you lose all styling, removing the default look and feel your visitors are used to.
94-
95-
To summarize, when it comes to styling form control widgets, the side effects of styling them with CSS can be unpredictable. So don't. Even if it's still possible to do a few adjustments on text elements (such as sizing or font color), there are always side effects. The best approach remains to not style HTML Form widgets at all. But you can still apply styles to all the surrounding items. And, if you must alter the default styles of your form widgets, define a style guide to ensure consistency among all your form controls so user experience is not destroyed. You can also investigate some hard techniques such as [rebuilding widgets with JavaScript](/en-US/docs/Learn_web_development/Extensions/Forms/How_to_build_custom_form_controls). But in that case, do not hesitate to [charge your client for such foolishness](https://www.smashingmagazine.com/2011/11/but-the-client-wants-ie-6-support/).
94+
If you must alter the default styles of your form widgets in legacy browsers, define a style guide to ensure consistency among all your form controls so user experience is not destroyed. You could also investigate some hard techniques such as [rebuilding widgets with JavaScript](/en-US/docs/Learn_web_development/Extensions/Forms/How_to_build_custom_form_controls), but it might be more trouble than it's worth.
9695

9796
## Feature detection and polyfills
9897

99-
CSS and JavaScript are awesome technologies, but it's important to ensure you don't break legacy browsers. Before using features that aren't fully supported in the browsers your targeting, you should feature detect:
98+
CSS and JavaScript are awesome technologies, but it's important to ensure you don't break legacy browsers. Before using features that aren't fully supported in the browsers your targeting, you should feature detect.
10099

101100
### CSS feature detection
102101

@@ -113,14 +112,42 @@ Before styling a replaced form control widget, you can check to see if the brows
113112

114113
The {{cssxref('appearance')}} property can be used to display an element using platform-native styling, or, as is done with the value of `none`, remove default platform-native based styling.
115114

115+
### JavaScript form input detection
116+
117+
You can use JavaScript to detect whether a particular input type is supported. This is based on the fact we mentioned before — that every input type falls back to `<input type="text">` in non-supporting browsers.
118+
119+
1. Define a test function. The first line of the function body should create a test `<input>` element:
120+
121+
```js
122+
function testDatetimeLocalSupport() {
123+
const testInput = document.createElement("input");
124+
```
125+
126+
2. Next, set its `type` attribute to the type you want to test:
127+
128+
```js-nolint
129+
testInput.setAttribute("type", "datetime-local");
130+
```
131+
132+
3. Now test the `type` attribute value. In browsers that don't support that input type, the last line will have no effect and the `type` will be returned as `text`. In the below line we are inverting the return value using the negation operator (`!`) because if the `type` isn't `text`, then the type is supported, so we want to return `true`:
133+
134+
```js
135+
return testInput.type !== "text";
136+
}
137+
```
138+
139+
The above example shows the basic idea behind such tests. Instead of reinventing the wheel, however, you should use a feature detection library such as [Modernizr](https://modernizr.com/) to handle such tests.
140+
141+
Based on the results of that test, you could then for example choose to use JavaScript to build a custom replacement for the non-supported type, or not apply a stylesheet that styles the non-supported type because you want to provide simple default styles to legacy browsers.
142+
116143
### Unobtrusive JavaScript
117144

118145
One of the biggest problems is the availability of APIs. For that reason, it's considered best practice to work with "unobtrusive" JavaScript. It's a development pattern that defines two requirements:
119146

120147
- A strict separation between structure and behaviors.
121148
- If the code breaks, the content and the basic functionalities must remain accessible and usable.
122149

123-
[The principles of unobtrusive JavaScript](https://www.w3.org/wiki/The_principles_of_unobtrusive_JavaScript) (originally written by Peter-Paul Koch for Dev.Opera.com) describes these ideas very well.
150+
[The principles of unobtrusive JavaScript](https://www.w3.org/wiki/The_principles_of_unobtrusive_JavaScript) (originally written by Peter-Paul Koch for dev.opera.com) describes these ideas very well.
124151

125152
### Pay attention to performance
126153

files/en-us/learn_web_development/extensions/forms/index.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,22 +54,23 @@ The above text is a good indicator as to why we've put web forms into its own st
5454
- [Sending form data](/en-US/docs/Learn_web_development/Extensions/Forms/Sending_and_retrieving_form_data)
5555
- : This article looks at what happens when a user submits a form — where does the data go, and how do we handle it when it gets there? We also look at some of the security concerns associated with sending form data.
5656

57-
## Additional articles
57+
## Additional tutorials
5858

5959
The following articles aren't included in the learning pathway, but they'll prove interesting and useful when you've mastered the above techniques and want to know more.
6060

6161
- [How to build custom form controls](/en-US/docs/Learn_web_development/Extensions/Forms/How_to_build_custom_form_controls)
6262
- : You'll come across some cases where the native form widgets just don't provide what you need, e.g., because of styling or functionality. In such cases, you may need to build your own form widget out of raw HTML. This article explains how you'd do this and the considerations you need to be aware of when doing so, with a practical case study.
6363
- [Sending forms through JavaScript](/en-US/docs/Learn_web_development/Extensions/Forms/Sending_forms_through_JavaScript)
6464
- : This article looks at ways to use a form to assemble an HTTP request and send it via custom JavaScript, rather than standard form submission. It also looks at why you'd want to do this, and the implications of doing so. (See also [Using FormData objects](/en-US/docs/Web/API/XMLHttpRequest_API/Using_FormData_Objects).)
65-
- [Customizable select elements](/en-US/docs/Learn_web_development/Extensions/Forms/Customizable_select)
66-
- : This article explains how to use dedicated, modern HTML and CSS features together to create fully-customized {{htmlelement("select")}} elements.
65+
- [HTML forms in legacy browsers](/en-US/docs/Learn_web_development/Extensions/Forms/HTML_forms_in_legacy_browsers)
66+
- : This article provides tips and tricks to help ease the pain if, and when, you need to support legacy browsers with your HTML forms.
67+
- [User input methods and controls](/en-US/docs/Learn_web_development/Extensions/Forms/User_input_methods)
68+
- : This article shows the different ways that users interact with forms and other web content, and provides recommendations for managing user input, real-world examples, and links to further information.
6769

6870
## See also
6971

7072
- [HTML forms element reference](/en-US/docs/Web/HTML/Reference/Elements#forms)
7173
- [HTML \<input> types reference](/en-US/docs/Web/HTML/Reference/Elements/input)
7274
- [HTML attribute reference](/en-US/docs/Web/HTML/Reference/Attributes)
73-
- [User input methods and controls](/en-US/docs/Learn_web_development/Extensions/Forms/User_input_methods)
7475

7576
{{NextMenu("Learn_web_development/Extensions/Forms/Your_first_form", "Learn_web_development/Extensions")}}

files/en-us/learn_web_development/extensions/forms/sending_forms_through_javascript/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
---
22
title: Sending forms through JavaScript
3+
short-title: JS form submission
34
slug: Learn_web_development/Extensions/Forms/Sending_forms_through_JavaScript
45
page-type: learn-module-chapter
56
sidebar: learnsidebar

files/en-us/learn_web_development/extensions/forms/user_input_methods/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
---
22
title: User input methods and controls
3+
short-title: UI methods & controls
34
slug: Learn_web_development/Extensions/Forms/User_input_methods
45
page-type: guide
56
sidebar: learnsidebar
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
---
2-
title: Web performance resources
3-
slug: Learn_web_development/Extensions/Performance/Web_Performance_Basics
2+
title: Web Performance best practices & tips
3+
short-title: Best practices & tips
4+
slug: Learn_web_development/Extensions/Performance/Best_practices
45
page-type: learn-module-chapter
56
sidebar: learnsidebar
67
---

files/en-us/learn_web_development/extensions/performance/business_case_for_performance/index.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ page-type: learn-module-chapter
66
sidebar: learnsidebar
77
---
88

9-
{{PreviousMenuNext("Learn_web_development/Extensions/Performance/CSS", "Learn_web_development/Extensions/Performance/Web_Performance_Basics", "Learn_web_development/Extensions/Performance")}}
9+
{{PreviousMenuNext("Learn_web_development/Extensions/Performance/CSS", "Learn_web_development/Extensions/Performance/Best_practices", "Learn_web_development/Extensions/Performance")}}
1010

1111
We've discussed the importance of web performance. You've learned what you need to do to optimize for web performance. But how do you convince your clients and/or management to prioritize and invest in performance? In this section, we discuss creating a clear business case to convince decision-makers to make the investment.
1212

@@ -55,4 +55,4 @@ Setting key performance indicators (KPI) as objectives can highlight performance
5555

5656
Setting conversion rate, time on site, and/or net promotion scores as KPIs give financial and other business goal value to the web performance efforts, and get help boost buy-in, with metrics to prove the efforts worth.
5757

58-
{{PreviousMenu("Learn_web_development/Extensions/Performance/CSS", "Learn_web_development/Extensions/Performance")}}
58+
{{PreviousMenuNext("Learn_web_development/Extensions/Performance/CSS", "Learn_web_development/Extensions/Performance/Best_practices", "Learn_web_development/Extensions/Performance")}}

files/en-us/learn_web_development/extensions/performance/index.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,11 @@ It would also be helpful to go a bit deeper into these topics, with modules such
4343
- : CSS may be a less important optimization focus for improved performance, but there are some CSS features that impact performance more than others. In this article we look at some CSS properties that impact performance and suggested ways of handling styles to ensure performance is not negatively impacted.
4444
- [The business case for web performance](/en-US/docs/Learn_web_development/Extensions/Performance/business_case_for_performance)
4545
- : There are many things a developer can do to improve performance, but how fast is fast enough? How can you convince powers that be of the importance of these efforts? Once optimized, how can you ensure bloat doesn't come back? In this article we look at convincing management, developing a performance culture and performance budget, and introduce ways to ensure regressions don't sneak into your code base.
46+
- [Web Performance best practices & tips](/en-US/docs/Learn_web_development/Extensions/Performance/Best_practices)
47+
- : This article covers several topics at a basic level and provides links to deeper dives to improve performance for each topic. In addition to front-end topics such as HTML, CSS, JavaScript, and media files, it also covers APIs, developer tools, best practices, and bad practices relating to web performance.
4648

4749
## See also
4850

49-
- [Web performance resources](/en-US/docs/Learn_web_development/Extensions/Performance/Web_Performance_Basics)
50-
- : In addition to the front end components of HTML, CSS, JavaScript, and media files, there are features that can make applications slower and features that can make applications subjectively and objectively faster. There are many APIs, developer tools, best practices, and bad practices relating to web performance. Here we'll introduce many of these features at the basic level and provide links to deeper dives to improve performance for each topic.
5151
- [Responsive images](/en-US/docs/Web/HTML/Guides/Responsive_images)
5252
- : In this article, we'll learn about the concept of responsive images — images that work well on devices with widely differing screen sizes, resolutions, and other such features — and look at what tools HTML provides to help implement them. This helps to improve performance across different devices. Responsive images are just one part of [responsive design](/en-US/docs/Learn_web_development/Core/CSS_layout/Responsive_Design), a future CSS topic for you to learn.
5353
- [Main web performance section on MDN](/en-US/docs/Web/Performance)

0 commit comments

Comments
 (0)