From 30ab2bf80b952a15dd3022a852d1a41d5c31a6fb Mon Sep 17 00:00:00 2001 From: Ryan Cavanaugh Date: Thu, 14 Apr 2022 10:45:34 -0700 Subject: [PATCH 01/10] Fix localization copy --- packages/typescriptlang-org/src/copy/en/community.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/typescriptlang-org/src/copy/en/community.ts b/packages/typescriptlang-org/src/copy/en/community.ts index 2d9cc242c6d1..fc5c0b67df10 100644 --- a/packages/typescriptlang-org/src/copy/en/community.ts +++ b/packages/typescriptlang-org/src/copy/en/community.ts @@ -1,8 +1,8 @@ export const comCopy = { - com_layout_title: "How to set up TypeScript", // FIXME: Is this the right title for the community page? + com_layout_title: "TypeScript Community Resources", com_layout_description: "Connect with other TypeScripters online and offline.", - com_headline: "Connect with us", // FIXME: I think this is not used anywhere + com_headline: "Connect with us", com_connect_online: "Online", com_connect_online_description: " Tell us what’s working well, what you want to see added or improved, and find out about new updates.", From 3c9338eface7cbe8dcf560c9d6e3a95ff2492e41 Mon Sep 17 00:00:00 2001 From: Ryan Cavanaugh Date: Thu, 14 Apr 2022 10:46:12 -0700 Subject: [PATCH 02/10] Add h1 block; fixes 1514624 --- packages/typescriptlang-org/src/templates/pages/community.tsx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/typescriptlang-org/src/templates/pages/community.tsx b/packages/typescriptlang-org/src/templates/pages/community.tsx index ee025f0b4191..715ee9bc819b 100644 --- a/packages/typescriptlang-org/src/templates/pages/community.tsx +++ b/packages/typescriptlang-org/src/templates/pages/community.tsx @@ -40,6 +40,9 @@ export const Comm: React.FC = props => { return ( +
+

{i("com_headline")}

+
From 50e9cd8c42db6f74e60a53f4865300ede38ee07c Mon Sep 17 00:00:00 2001 From: Ryan Cavanaugh Date: Thu, 14 Apr 2022 10:48:10 -0700 Subject: [PATCH 03/10] Make hidden element unfocusable; fixes 1514640 --- .../src/components/layout/SiteFooter-PlaygroundSamples.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/typescriptlang-org/src/components/layout/SiteFooter-PlaygroundSamples.tsx b/packages/typescriptlang-org/src/components/layout/SiteFooter-PlaygroundSamples.tsx index e3561e306dd3..e8dd3572c7f9 100644 --- a/packages/typescriptlang-org/src/components/layout/SiteFooter-PlaygroundSamples.tsx +++ b/packages/typescriptlang-org/src/components/layout/SiteFooter-PlaygroundSamples.tsx @@ -50,7 +50,7 @@ export const PlaygroundSamples = (props: Props) => { }, []); return ( -
  • -
      +
      -
    +
  • From 3f84cce764df06a2e74b1a62ca244573c9551ae8 Mon Sep 17 00:00:00 2001 From: Ryan Cavanaugh Date: Thu, 14 Apr 2022 11:47:11 -0700 Subject: [PATCH 05/10] Set tab role on proper child. Fixes 1515372; 1515405 --- packages/typescriptlang-org/src/components/ShowExamples.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/typescriptlang-org/src/components/ShowExamples.tsx b/packages/typescriptlang-org/src/components/ShowExamples.tsx index 8630312eb2b3..eb2d23b49a5a 100644 --- a/packages/typescriptlang-org/src/components/ShowExamples.tsx +++ b/packages/typescriptlang-org/src/components/ShowExamples.tsx @@ -113,8 +113,8 @@ export const RenderExamples = (props: Props) => { const startOpen = section.id === props.defaultSection const selectedClass = startOpen ? " selected" : "" return ( -
  • - +
  • +
  • ) } From 9382eb81c22b74d6bb84df973a4c8565543b3f44 Mon Sep 17 00:00:00 2001 From: Ryan Cavanaugh Date: Thu, 14 Apr 2022 12:38:31 -0700 Subject: [PATCH 06/10] Use proper aria roles for version tabs. Fixes 1515425 --- .../src/components/ShowExamples.scss | 49 ++++++++++--------- .../src/components/ShowExamples.tsx | 8 ++- 2 files changed, 28 insertions(+), 29 deletions(-) diff --git a/packages/typescriptlang-org/src/components/ShowExamples.scss b/packages/typescriptlang-org/src/components/ShowExamples.scss index 30116819454b..5127a2485e88 100644 --- a/packages/typescriptlang-org/src/components/ShowExamples.scss +++ b/packages/typescriptlang-org/src/components/ShowExamples.scss @@ -14,8 +14,28 @@ color: var(--link-color); } + button.section-name { + font-size: 2rem; + font-weight: 600; + + height: 2.8rem; + text-decoration: none; + border-bottom: none; + padding-bottom: 0.05rem; + margin-top: 0; + padding-top: 0; + margin-right: 1rem; + border: none; + background-color: transparent; + color: var(--text-color); + } + + button.section-name.selected { + border-bottom: $ts-main-blue-color 2px solid; + } + // The titles of the sections - > ol { + >ol { padding-left: 0; li { @@ -28,26 +48,6 @@ background-color: transparent; } } - - button.section-name { - font-size: 2rem; - font-weight: 600; - - height: 2.8rem; - text-decoration: none; - border-bottom: none; - padding-bottom: 0.05rem; - margin-top: 0; - padding-top: 0; - margin-right: 1rem; - border: none; - background-color: transparent; - color: var(--text-color); - } - - button.section-name.selected { - border-bottom: $ts-main-blue-color 2px solid; - } } ol { @@ -56,11 +56,11 @@ padding-left: 0; } - > div.section-content { + >div.section-content { flex-wrap: wrap; display: flex; - > p > a { + >p>a { display: inline-block; color: $ts-main-blue-color; padding: 0; @@ -118,6 +118,7 @@ &.done { background-color: $ts-main-blue-darker-color; } + &.changed { border: $ts-main-blue-darker-color 1px solid; } @@ -126,4 +127,4 @@ } } } -} +} \ No newline at end of file diff --git a/packages/typescriptlang-org/src/components/ShowExamples.tsx b/packages/typescriptlang-org/src/components/ShowExamples.tsx index eb2d23b49a5a..92443572919d 100644 --- a/packages/typescriptlang-org/src/components/ShowExamples.tsx +++ b/packages/typescriptlang-org/src/components/ShowExamples.tsx @@ -108,18 +108,16 @@ export const RenderExamples = (props: Props) => { const sections = props.sections.map(sectionID => locale.sections.find(localeSection => sectionID === localeSection.id) || english.sections.find(localeSection => sectionID === localeSection.id)) return (
    -
      +
      {sections.map(section => { const startOpen = section.id === props.defaultSection const selectedClass = startOpen ? " selected" : "" return ( -
    1. - -
    2. + ) } )} -
    +
    {sections.map(section => { const sectionDict = sortedSectionsDictionary(locale, section) From b3d296d9325672b7fe2eaeb7b00f4f0f428f2fc1 Mon Sep 17 00:00:00 2001 From: Ryan Cavanaugh Date: Thu, 14 Apr 2022 13:10:56 -0700 Subject: [PATCH 07/10] Improve contrast ratios throughout; fixes 1515465 h2 -> h1; fixes 1515494 --- .../src/templates/documentation.scss | 28 +++++++++---- .../src/templates/documentation.tsx | 24 +++++------ .../src/templates/markdown-twoslash.scss | 41 +++++++++++++++---- 3 files changed, 64 insertions(+), 29 deletions(-) diff --git a/packages/typescriptlang-org/src/templates/documentation.scss b/packages/typescriptlang-org/src/templates/documentation.scss index c18b4a48b4f1..636764604b1f 100644 --- a/packages/typescriptlang-org/src/templates/documentation.scss +++ b/packages/typescriptlang-org/src/templates/documentation.scss @@ -1,13 +1,11 @@ @import "../style/globals.scss"; #beta { - background: repeating-linear-gradient( - 45deg, - #9b9a4e, - #9b9a4e 10px, - #6e6a33 10px, - #6e6a33 20px - ); + background: repeating-linear-gradient(45deg, + #9b9a4e, + #9b9a4e 10px, + #6e6a33 10px, + #6e6a33 20px); background-color: "#c63131"; text-align: center; color: white; @@ -32,7 +30,7 @@ } // Page title - & > h2 { + &>h1 { font-size: 3.5rem; line-height: 3.5rem; font-weight: 400; @@ -76,9 +74,11 @@ nav { position: sticky; top: 30px; + &.deprecated { top: 7rem; } + margin-bottom: 1rem; } @@ -120,6 +120,7 @@ } .like-dislike-subnav { + #like-button, #dislike-button { cursor: pointer; @@ -130,6 +131,7 @@ .preamble a { color: var(--text-color); } + .justify-between { justify-content: space-between; } @@ -269,6 +271,7 @@ margin: 0 0 0 0; padding: 1rem; flex-direction: column; + h3 { font-size: 0.8rem; } @@ -276,6 +279,7 @@ #deprecated-icon { margin-right: 1rem; } + #deprecated-action { margin-top: 1rem; } @@ -325,24 +329,30 @@ tr { width: 100%; + p { margin: 0; padding: 0; } + code { word-wrap: normal; } } + // Override the default stripes tr.odd { background-color: var(--background-color) !important; } + tr.even { background-color: var(--background-minor-highlight-color) !important; } + ul { margin: 0; padding: 0; + li { list-style: none; margin: 0; @@ -446,4 +456,4 @@ -webkit-animation: 0.1s ease forwards; animation: 0.1s ease forwards; } -} +} \ No newline at end of file diff --git a/packages/typescriptlang-org/src/templates/documentation.tsx b/packages/typescriptlang-org/src/templates/documentation.tsx index 0cae8d84ece4..a678d8cc478e 100644 --- a/packages/typescriptlang-org/src/templates/documentation.tsx +++ b/packages/typescriptlang-org/src/templates/documentation.tsx @@ -138,21 +138,21 @@ const HandbookTemplate: React.FC = (props) => { } - {showExperimental && -
    -
    -
    - -
    -
    -

    {i("handb_experimental_title")}

    -

    {i("handb_experimental_subtitle")}

    -
    + {showExperimental && +
    +
    +
    +
    +
    +

    {i("handb_experimental_title")}

    +

    {i("handb_experimental_subtitle")}

    +
    +
    } -

    {post.frontmatter.title}

    +

    {post.frontmatter.title}

    {post.frontmatter.preamble &&
    }
    @@ -190,7 +190,7 @@ const HandbookTemplate: React.FC = (props) => {
    - + ) } diff --git a/packages/typescriptlang-org/src/templates/markdown-twoslash.scss b/packages/typescriptlang-org/src/templates/markdown-twoslash.scss index 62ced3218a70..dc10d9cd644a 100644 --- a/packages/typescriptlang-org/src/templates/markdown-twoslash.scss +++ b/packages/typescriptlang-org/src/templates/markdown-twoslash.scss @@ -30,24 +30,30 @@ pre { overflow-x: auto; position: relative; } + pre.shiki { overflow-x: auto; } + pre.shiki:hover .dim { opacity: 1; } + pre.shiki div.dim { - opacity: 0.5; + opacity: 0.9; } + pre.shiki div.dim, pre.shiki div.highlight { margin: 0; padding: 0; } + pre.shiki div.highlight { opacity: 1; background-color: #f1f8ff; } + pre.shiki div.line { min-height: 1rem; } @@ -87,8 +93,9 @@ pre.twoslash data-lsp:hover::before { pre .code-container { overflow: auto; } + /* The try button */ -pre .code-container > a { +pre .code-container>a { position: absolute; right: 8px; bottom: 8px; @@ -101,16 +108,19 @@ pre .code-container > a { transition-timing-function: ease; transition: opacity 0.3s; } + /* Respect no animations */ @media (prefers-reduced-motion: reduce) { - pre .code-container > a { + pre .code-container>a { transition: none; } } -pre .code-container > a:hover { + +pre .code-container>a:hover { color: white; background-color: #719af4; } + pre .code-container:hover a { opacity: 1; } @@ -121,6 +131,7 @@ pre code { white-space: pre; -webkit-overflow-scrolling: touch; } + pre code a { text-decoration: none; } @@ -148,6 +159,7 @@ pre .error-behind { white-space: pre-wrap; display: block; } + pre .error { position: absolute; background-color: #fee; @@ -158,14 +170,17 @@ pre .error { align-items: center; color: black; } + pre .error .code { display: none; } + pre .error-behind { user-select: none; visibility: transparent; color: #fee; } + /* Queries */ pre .arrow { /* Transparent background */ @@ -181,6 +196,7 @@ pre .arrow { height: 8px; width: 8px; } + pre .popover { margin-bottom: 10px; background-color: #eee; @@ -189,13 +205,14 @@ pre .popover { margin-top: 10px; border-radius: 3px; } + /* Completion */ pre .inline-completions ul.dropdown { display: inline-block; position: absolute; width: 240px; - background-color: gainsboro; - color: grey; + background-color: #E7E7E7; + color: #333; padding-top: 4px; font-family: var(--code-font); font-size: 0.8rem; @@ -203,6 +220,7 @@ pre .inline-completions ul.dropdown { padding: 0; border-left: 4px solid #4b9edd; } + pre .inline-completions ul.dropdown::before { background-color: #4b9edd; width: 2px; @@ -211,27 +229,33 @@ pre .inline-completions ul.dropdown::before { left: -3px; content: " "; } + pre .inline-completions ul.dropdown li { overflow-x: hidden; padding-left: 4px; margin-bottom: 4px; } + pre .inline-completions ul.dropdown li.deprecated { text-decoration: line-through; } + pre .inline-completions ul.dropdown li span.result-found { - color: #4b9edd; + color: #2265a5; } + pre .inline-completions ul.dropdown li span.result { width: 100px; color: black; display: inline-block; } + .dark-theme .markdown pre { background-color: #d8d8d8; border-color: #ddd; filter: invert(98%) hue-rotate(180deg); } + data-lsp { /* Ensures there's no 1px jump when the hover happens */ border-bottom: 1px dotted transparent; @@ -239,6 +263,7 @@ data-lsp { transition-timing-function: ease; transition: border-color 0.3s; } + /* Respect people's wishes to not have animations */ @media (prefers-reduced-motion: reduce) { data-lsp { @@ -273,4 +298,4 @@ data-lsp { } } } -} +} \ No newline at end of file From 760f5f6b4401a18f612ab0338697064ccb028857 Mon Sep 17 00:00:00 2001 From: Ryan Cavanaugh Date: Thu, 14 Apr 2022 13:16:57 -0700 Subject: [PATCH 08/10] Paint link icon in white in high contrast mode; fixes 1515516 --- .../src/templates/pages/css/documentation.scss | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/typescriptlang-org/src/templates/pages/css/documentation.scss b/packages/typescriptlang-org/src/templates/pages/css/documentation.scss index 8127e03ae90f..4e8f3d765e63 100644 --- a/packages/typescriptlang-org/src/templates/pages/css/documentation.scss +++ b/packages/typescriptlang-org/src/templates/pages/css/documentation.scss @@ -28,6 +28,7 @@ &:hover { background-color: $ts-light-bg-grey; } + &:active { background-color: $ts-light-bg-grey-highlight-color; margin-bottom: 19px; @@ -36,6 +37,10 @@ @media screen and (-ms-high-contrast: active) { border: 1px solid grey; + + svg path { + fill: white; + } } &.headline { @@ -99,6 +104,7 @@ &.wide { justify-content: space-between; + .item { min-width: 240px; } @@ -154,4 +160,4 @@ div#like-dislike-subnav { } } } -} +} \ No newline at end of file From 06e32d5d6cc8db47b206610766331a9b7fdfeab9 Mon Sep 17 00:00:00 2001 From: Ryan Cavanaugh Date: Thu, 14 Apr 2022 13:24:15 -0700 Subject: [PATCH 09/10] Remove like/dislike from tab order when not visible Fixes 1515517 and 1515523 --- packages/typescriptlang-org/src/templates/documentation.tsx | 2 +- .../src/templates/scripts/setupLikeDislikeButtons.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/typescriptlang-org/src/templates/documentation.tsx b/packages/typescriptlang-org/src/templates/documentation.tsx index a678d8cc478e..7b698c2e1fd7 100644 --- a/packages/typescriptlang-org/src/templates/documentation.tsx +++ b/packages/typescriptlang-org/src/templates/documentation.tsx @@ -96,7 +96,7 @@ const HandbookTemplate: React.FC = (props) => {
    -
    +

    Was this page helpful?

    diff --git a/packages/typescriptlang-org/src/templates/scripts/setupLikeDislikeButtons.ts b/packages/typescriptlang-org/src/templates/scripts/setupLikeDislikeButtons.ts index 027270497f81..d0677590d3f0 100644 --- a/packages/typescriptlang-org/src/templates/scripts/setupLikeDislikeButtons.ts +++ b/packages/typescriptlang-org/src/templates/scripts/setupLikeDislikeButtons.ts @@ -55,7 +55,7 @@ export const setupLikeDislikeButtons = (slug: string, i: any) => { const popupOpacity = bottomOfWindow ? "1" : "0" if (popup.style.opacity != popupOpacity) { - // popup.style.display = bottomOfWindow ? "block" : "none" + popup.style.display = bottomOfWindow ? "block" : "none" popup.style.opacity = popupOpacity } From 29d2703503c59c314ae8a0bd701cc3ff1b2afa67 Mon Sep 17 00:00:00 2001 From: Ryan Cavanaugh Date: Thu, 14 Apr 2022 13:33:01 -0700 Subject: [PATCH 10/10] Remove duplicate nav element; fixes 1522530 --- .../typescriptlang-org/src/components/layout/TopNav.tsx | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/packages/typescriptlang-org/src/components/layout/TopNav.tsx b/packages/typescriptlang-org/src/components/layout/TopNav.tsx index c90245dfb05d..12dab9f44515 100644 --- a/packages/typescriptlang-org/src/components/layout/TopNav.tsx +++ b/packages/typescriptlang-org/src/components/layout/TopNav.tsx @@ -30,7 +30,7 @@ export const SiteNav = (props: Props) => { // @ts-ignore - this comes from the script above docsearch({ - appId:"BGCDYOIYZ5", + appId: "BGCDYOIYZ5", apiKey: '37ee06fa68db6aef451a490df6df7c60', indexName: 'typescriptlang', inputSelector: '.search input', @@ -99,8 +99,7 @@ export const SiteNav = (props: Props) => {
    - - +