diff --git a/.eslintrc.js b/.eslintrc.js index e7e07f9513be..d7eca7cfe5b8 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -35,6 +35,10 @@ module.exports = { rules: { "@typescript-eslint/no-explicit-any": "off", "@typescript-eslint/no-var-requires": "off", + "@typescript-eslint/no-unused-vars": [ + "warn", + { ignoreRestSiblings: true }, + ], "n/no-missing-import": "off", "n/no-unpublished-import": "off", "n/shebang": "off", diff --git a/.github/workflows/dev-build.yml b/.github/workflows/dev-build.yml index c260c24f69a1..18047613a2e3 100644 --- a/.github/workflows/dev-build.yml +++ b/.github/workflows/dev-build.yml @@ -204,7 +204,7 @@ jobs: poetry run deployer search-index ../client/build - name: Configure AWS Credentials - uses: aws-actions/configure-aws-credentials@v1 + uses: aws-actions/configure-aws-credentials@v1-node16 with: aws-access-key-id: ${{ secrets.DEPLOYER_STAGE_AND_DEV_AWS_ACCESS_KEY_ID }} aws-secret-access-key: ${{ secrets.DEPLOYER_STAGE_AND_DEV_AWS_SECRET_ACCESS_KEY }} diff --git a/.github/workflows/labeler.yml b/.github/workflows/labeler.yml index e54c56a1945b..3a337565ffc8 100644 --- a/.github/workflows/labeler.yml +++ b/.github/workflows/labeler.yml @@ -6,6 +6,6 @@ jobs: triage: runs-on: ubuntu-latest steps: - - uses: actions/labeler@v4.0.2 + - uses: actions/labeler@4.1.0 with: repo-token: "${{ secrets.GITHUB_TOKEN }}" diff --git a/.github/workflows/prod-build.yml b/.github/workflows/prod-build.yml index 3b8ab6c1ec25..02dbd71cf9ca 100644 --- a/.github/workflows/prod-build.yml +++ b/.github/workflows/prod-build.yml @@ -250,7 +250,7 @@ jobs: poetry run deployer search-index ../client/build - name: Configure AWS Credentials - uses: aws-actions/configure-aws-credentials@v1 + uses: aws-actions/configure-aws-credentials@v1-node16 with: aws-access-key-id: ${{ secrets.DEPLOYER_PROD_AWS_ACCESS_KEY_ID }} aws-secret-access-key: ${{ secrets.DEPLOYER_PROD_AWS_SECRET_ACCESS_KEY }} diff --git a/.github/workflows/stage-build.yml b/.github/workflows/stage-build.yml index e0bd031ee12d..2857d0587896 100644 --- a/.github/workflows/stage-build.yml +++ b/.github/workflows/stage-build.yml @@ -248,7 +248,7 @@ jobs: poetry run deployer search-index ../client/build - name: Configure AWS Credentials - uses: aws-actions/configure-aws-credentials@v1 + uses: aws-actions/configure-aws-credentials@v1-node16 with: aws-access-key-id: ${{ secrets.DEPLOYER_STAGE_AND_DEV_AWS_ACCESS_KEY_ID }} aws-secret-access-key: ${{ secrets.DEPLOYER_STAGE_AND_DEV_AWS_SECRET_ACCESS_KEY }} diff --git a/build/cli.ts b/build/cli.ts index 05c31180bd87..885cdadc8dc5 100644 --- a/build/cli.ts +++ b/build/cli.ts @@ -15,7 +15,7 @@ import { VALID_LOCALES } from "../libs/constants"; import { renderHTML } from "../ssr/dist/main"; import options from "./build-options"; import { buildDocument, BuiltDocument, renderContributorsTxt } from "."; -import { DocMetadata, Flaws } from "../libs/types"; +import { Flaws } from "../libs/types"; import * as bcd from "@mdn/browser-compat-data/types"; import SearchIndex from "./search-index"; import { BUILD_OUT_ROOT } from "../libs/env"; diff --git a/build/document-extractor.ts b/build/document-extractor.ts index e19377597bcd..1b1249b9f365 100644 --- a/build/document-extractor.ts +++ b/build/document-extractor.ts @@ -14,6 +14,7 @@ import web from "../kumascript/src/api/web"; interface SimpleSupportStatementWithReleaseDate extends bcd.SimpleSupportStatement { release_date?: string; + version_last?: bcd.VersionValue; } type SectionsAndFlaws = [Section[], string[]]; @@ -464,16 +465,17 @@ function _addSingleSpecialSection( : [originalInfo]; for (const infoEntry of infos) { - const added = - typeof infoEntry.version_added === "string" && - infoEntry.version_added.startsWith("≤") - ? infoEntry.version_added.slice(1) - : infoEntry.version_added; + const added = _normalizeVersion(infoEntry.version_added); + const removed = _normalizeVersion(infoEntry.version_removed); if (browserReleaseData.has(browser)) { if (browserReleaseData.get(browser).has(added)) { infoEntry.release_date = browserReleaseData .get(browser) .get(added).release_date; + infoEntry.version_last = _getPreviousVersion( + removed, + browsers[browser] + ); } } } @@ -506,6 +508,29 @@ function _addSingleSpecialSection( ]; } + function _getPreviousVersion( + version: bcd.VersionValue, + browser: bcd.BrowserStatement + ): bcd.VersionValue { + if (browser && typeof version === "string") { + const browserVersions = Object.keys(browser["releases"]).sort( + _compareVersions + ); + const currentVersionIndex = browserVersions.indexOf(version); + if (currentVersionIndex > 0) { + return browserVersions[currentVersionIndex - 1]; + } + } + + return version; + } + + function _normalizeVersion(version: bcd.VersionValue): bcd.VersionValue { + return typeof version === "string" && version.startsWith("≤") + ? version.slice(1) + : version; + } + function _getFirstVersion(support: bcd.SimpleSupportStatement): string { if (typeof support.version_added === "string") { return support.version_added; diff --git a/build/wrap-tables.ts b/build/wrap-tables.ts index cf1f98617f5c..c4622b232783 100644 --- a/build/wrap-tables.ts +++ b/build/wrap-tables.ts @@ -1,7 +1,7 @@ -// Wraps tables in a scrollable div to avoid overlapping with the TOC sidebar. +// Wraps tables in a scrollable figure to avoid overlapping with the TOC sidebar. // Before: ...
-// After:
...
+// After:
...
export function wrapTables($) { - const div = $('
'); - $("table").wrap(div); + const figure = $('
'); + $("table").wrap(figure); } diff --git a/client/pwa/package.json b/client/pwa/package.json index 26499d627e98..95b870b69aec 100644 --- a/client/pwa/package.json +++ b/client/pwa/package.json @@ -17,9 +17,9 @@ "devDependencies": { "@types/dexie": "1.3.1", "ts-loader": "^9.4.1", - "typescript": "^4.8.4", + "typescript": "^4.9.3", "webpack": "^5.75.0", - "webpack-cli": "^4.10.0", + "webpack-cli": "^5.0.0", "workers-preview": "^1.0.6" } } diff --git a/client/pwa/src/db.ts b/client/pwa/src/db.ts index 8ef6f2202407..ee15e79fbc4a 100644 --- a/client/pwa/src/db.ts +++ b/client/pwa/src/db.ts @@ -8,7 +8,6 @@ import Dexie from "dexie"; export enum SwType { PreferOnline = "PreferOnline", PreferOffline = "PreferOffline", - ApiOnly = "ApiOnly", } export interface PlusSettings { diff --git a/client/pwa/src/service-worker.ts b/client/pwa/src/service-worker.ts index ca1f5d3edcc4..3be0b09999b7 100644 --- a/client/pwa/src/service-worker.ts +++ b/client/pwa/src/service-worker.ts @@ -26,7 +26,8 @@ const UPDATES_BASE_URL = `https://updates.${ }`; const SW_TYPE: SwType = - SwType[new URLSearchParams(location.search).get("type")] || SwType.ApiOnly; + SwType[new URLSearchParams(location.search).get("type")] || + SwType.PreferOnline; // export empty type because of tsc --isolatedModules flag export type {}; @@ -36,21 +37,19 @@ var unpacking = Promise.resolve(); self.addEventListener("install", (e) => { e.waitUntil( - SW_TYPE === SwType.ApiOnly - ? self.skipWaiting() - : (async () => { - const cache = await openCache(); - const { files = {} }: { files: object } = - (await (await fetch("/asset-manifest.json")).json()) || {}; - const assets = [...Object.values(files)].filter( - (asset) => !(asset as string).endsWith(".map") - ); - let keys = new Set( - (await cache.keys()).map((r) => r.url.replace(location.origin, "")) - ); - const toCache = assets.filter((file) => !keys.has(file)); - await cache.addAll(toCache as string[]); - })().then(() => self.skipWaiting()) + (async () => { + const cache = await openCache(); + const { files = {} }: { files: object } = + (await (await fetch("/asset-manifest.json")).json()) || {}; + const assets = [...Object.values(files)].filter( + (asset) => !(asset as string).endsWith(".map") + ); + let keys = new Set( + (await cache.keys()).map((r) => r.url.replace(location.origin, "")) + ); + const toCache = assets.filter((file) => !keys.has(file)); + await cache.addAll(toCache as string[]); + })().then(() => self.skipWaiting()) ); initOncePerRun(self); @@ -58,7 +57,7 @@ self.addEventListener("install", (e) => { self.addEventListener("fetch", async (e) => { if ( - (SW_TYPE === SwType.ApiOnly || SW_TYPE === SwType.PreferOnline) && + SW_TYPE === SwType.PreferOnline && !e.request.url.includes("/api/v1/") && !e.request.url.includes("/users/fxa/") ) { diff --git a/client/pwa/yarn.lock b/client/pwa/yarn.lock index b8a74fa4ec72..5730c408806c 100644 --- a/client/pwa/yarn.lock +++ b/client/pwa/yarn.lock @@ -206,22 +206,20 @@ "@webassemblyjs/ast" "1.11.1" "@xtuc/long" "4.2.2" -"@webpack-cli/configtest@^1.2.0": - version "1.2.0" - resolved "https://registry.yarnpkg.com/@webpack-cli/configtest/-/configtest-1.2.0.tgz#7b20ce1c12533912c3b217ea68262365fa29a6f5" - integrity sha512-4FB8Tj6xyVkyqjj1OaTqCjXYULB9FMkqQ8yGrZjRDrYh0nOE+7Lhs45WioWQQMV+ceFlE368Ukhe6xdvJM9Egg== +"@webpack-cli/configtest@^2.0.0": + version "2.0.0" + resolved "https://registry.yarnpkg.com/@webpack-cli/configtest/-/configtest-2.0.0.tgz#5e1bc37064c7d00e1330641fa523f8ff85a39513" + integrity sha512-war4OU8NGjBqU3DP3bx6ciODXIh7dSXcpQq+P4K2Tqyd8L5OjZ7COx9QXx/QdCIwL2qoX09Wr4Cwf7uS4qdEng== -"@webpack-cli/info@^1.5.0": - version "1.5.0" - resolved "https://registry.yarnpkg.com/@webpack-cli/info/-/info-1.5.0.tgz#6c78c13c5874852d6e2dd17f08a41f3fe4c261b1" - integrity sha512-e8tSXZpw2hPl2uMJY6fsMswaok5FdlGNRTktvFk2sD8RjH0hE2+XistawJx1vmKteh4NmGmNUrp+Tb2w+udPcQ== - dependencies: - envinfo "^7.7.3" +"@webpack-cli/info@^2.0.0": + version "2.0.0" + resolved "https://registry.yarnpkg.com/@webpack-cli/info/-/info-2.0.0.tgz#5a58476b129ee9b462117b23393596e726bf3b80" + integrity sha512-NNxDgbo4VOkNhOlTgY0Elhz3vKpOJq4/PKeKg7r8cmYM+GQA9vDofLYyup8jS6EpUvhNmR30cHTCEIyvXpskwA== -"@webpack-cli/serve@^1.7.0": - version "1.7.0" - resolved "https://registry.yarnpkg.com/@webpack-cli/serve/-/serve-1.7.0.tgz#e1993689ac42d2b16e9194376cfb6753f6254db1" - integrity sha512-oxnCNGj88fL+xzV+dacXs44HcDwf1ovs3AuEzvP7mqXw7fQntqIhQ1BRmynh4qEKQSSSRSWVyXRjmTbZIX9V2Q== +"@webpack-cli/serve@^2.0.0": + version "2.0.0" + resolved "https://registry.yarnpkg.com/@webpack-cli/serve/-/serve-2.0.0.tgz#f08ea194e01ed45379383a8886e8c85a65a5f26a" + integrity sha512-Rumq5mHvGXamnOh3O8yLk1sjx8dB30qF1OeR6VC00DIR6SLJ4bwwUGKC4pE7qBFoQyyh0H9sAg3fikYgAqVR0w== "@xtuc/ieee754@^1.2.0": version "1.2.0" @@ -342,10 +340,10 @@ commander@^2.20.0: resolved "https://registry.yarnpkg.com/commander/-/commander-2.20.3.tgz#fd485e84c03eb4881c20722ba48035e8531aeb33" integrity sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ== -commander@^7.0.0: - version "7.2.0" - resolved "https://registry.yarnpkg.com/commander/-/commander-7.2.0.tgz#a36cb57d0b501ce108e4d20559a150a391d97ab7" - integrity sha512-QrWXB+ZQSVPmIWIhtEO9H+gwHaMGYiF5ChvoJ+K9ZGHG/sVsa6yiesAD1GC/x46sET00Xlwo1u49RVVVzvcSkw== +commander@^9.4.1: + version "9.4.1" + resolved "https://registry.yarnpkg.com/commander/-/commander-9.4.1.tgz#d1dd8f2ce6faf93147295c0df13c7c21141cfbdd" + integrity sha512-5EEkTNyHNGFPD2H+c/dXXfQZYa/scCKasxWcXJaWnNJ99pnQN9Vnmqow+p+PlFPE63Q6mThaZws1T+HxfpgtPw== cross-spawn@^7.0.3: version "7.0.3" @@ -484,15 +482,15 @@ import-local@^3.0.2: pkg-dir "^4.2.0" resolve-cwd "^3.0.0" -interpret@^2.2.0: - version "2.2.0" - resolved "https://registry.yarnpkg.com/interpret/-/interpret-2.2.0.tgz#1a78a0b5965c40a5416d007ad6f50ad27c417df9" - integrity sha512-Ju0Bz/cEia55xDwUWEa8+olFpCiQoypjnQySseKtmjNrnps3P+xfpUmGr90T7yjlVJmOtybRvPXhKMbHr+fWnw== +interpret@^3.1.1: + version "3.1.1" + resolved "https://registry.yarnpkg.com/interpret/-/interpret-3.1.1.tgz#5be0ceed67ca79c6c4bc5cf0d7ee843dcea110c4" + integrity sha512-6xwYfHbajpoF0xLW+iwLkhwgvLoZDfjYfoFNu8ftMoXINzwuymNLd9u/KmwtdT2GbR+/Cz66otEGEVVUHX9QLQ== -is-core-module@^2.8.1: - version "2.8.1" - resolved "https://registry.yarnpkg.com/is-core-module/-/is-core-module-2.8.1.tgz#f59fdfca701d5879d0a6b100a40aa1560ce27211" - integrity sha512-SdNCUs284hr40hFTFP6l0IfZ/RSrMXF3qgoRHd3/79unUTvrFO/JoXwkGm+5J/Oe3E/b5GsnG330uUNgRpu1PA== +is-core-module@^2.9.0: + version "2.11.0" + resolved "https://registry.yarnpkg.com/is-core-module/-/is-core-module-2.11.0.tgz#ad4cb3e3863e814523c96f3f58d26cc570ff0144" + integrity sha512-RRjxlvLDkD1YJwDbroBHMb+cukurkDWNyHx7D3oNB5x9rb5ogcksMC5wHCadcXoo67gVr/+3GFySh3134zi6rw== dependencies: has "^1.0.3" @@ -671,12 +669,12 @@ randombytes@^2.1.0: dependencies: safe-buffer "^5.1.0" -rechoir@^0.7.0: - version "0.7.1" - resolved "https://registry.yarnpkg.com/rechoir/-/rechoir-0.7.1.tgz#9478a96a1ca135b5e88fc027f03ee92d6c645686" - integrity sha512-/njmZ8s1wVeR6pjTZ+0nCnv8SpZNRMT2D1RLOJQESlYFDBvwpTA4KWJpZ+sBJ4+vhjILRcK7JIFdGCdxEAAitg== +rechoir@^0.8.0: + version "0.8.0" + resolved "https://registry.yarnpkg.com/rechoir/-/rechoir-0.8.0.tgz#49f866e0d32146142da3ad8f0eff352b3215ff22" + integrity sha512-/vxpCXddiX8NGfGO/mTafwjq4aFa/71pvamip0++IQk3zG8cbCj0fifNPrjjF1XMXUne91jL9OoxmdykoEtifQ== dependencies: - resolve "^1.9.0" + resolve "^1.20.0" resolve-cwd@^3.0.0: version "3.0.0" @@ -690,12 +688,12 @@ resolve-from@^5.0.0: resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-5.0.0.tgz#c35225843df8f776df21c57557bc087e9dfdfc69" integrity sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw== -resolve@^1.9.0: - version "1.22.0" - resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.22.0.tgz#5e0b8c67c15df57a89bdbabe603a002f21731198" - integrity sha512-Hhtrw0nLeSrFQ7phPp4OOcVjLPIeMnRlr5mcnVuMe7M/7eBn98A3hmFRLoFo3DLZkivSYwhRUJTyPyWAk56WLw== +resolve@^1.20.0: + version "1.22.1" + resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.22.1.tgz#27cb2ebb53f91abb49470a928bba7558066ac177" + integrity sha512-nBpuuYuY5jFsli/JIs1oldw6fOQCBioohqWZg/2hiaOybXOft4lonv85uDOKXdf8rhyK159cxU5cDcK/NKk8zw== dependencies: - is-core-module "^2.8.1" + is-core-module "^2.9.0" path-parse "^1.0.7" supports-preserve-symlinks-flag "^1.0.0" @@ -821,10 +819,10 @@ ts-loader@^9.4.1: micromatch "^4.0.0" semver "^7.3.4" -typescript@^4.8.4: - version "4.8.4" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.8.4.tgz#c464abca159669597be5f96b8943500b238e60e6" - integrity sha512-QCh+85mCy+h0IGff8r5XWzOVSbBO+KfeYrMQh7NJ58QujwcE22u+NUSmUxqF+un70P9GXKxa2HCNiTTMJknyjQ== +typescript@^4.9.3: + version "4.9.3" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.9.3.tgz#3aea307c1746b8c384435d8ac36b8a2e580d85db" + integrity sha512-CIfGzTelbKNEnLpLdGFgdyKhG23CKdKgQPOBc+OUNrkJ2vr+KSzsSV5kq5iWhEQbok+quxgGzrAtGWCyU7tHnA== uri-js@^4.2.2: version "4.4.1" @@ -841,22 +839,23 @@ watchpack@^2.4.0: glob-to-regexp "^0.4.1" graceful-fs "^4.1.2" -webpack-cli@^4.10.0: - version "4.10.0" - resolved "https://registry.yarnpkg.com/webpack-cli/-/webpack-cli-4.10.0.tgz#37c1d69c8d85214c5a65e589378f53aec64dab31" - integrity sha512-NLhDfH/h4O6UOy+0LSso42xvYypClINuMNBVVzX4vX98TmTaTUxwRbXdhucbFMd2qLaCTcLq/PdYrvi8onw90w== +webpack-cli@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/webpack-cli/-/webpack-cli-5.0.0.tgz#bd380a9653e0cd1a08916c4ff1adea17201ef68f" + integrity sha512-AACDTo20yG+xn6HPW5xjbn2Be4KUzQPebWXsDMHwPPyKh9OnTOJgZN2Nc+g/FZKV3ObRTYsGvibAvc+5jAUrVA== dependencies: "@discoveryjs/json-ext" "^0.5.0" - "@webpack-cli/configtest" "^1.2.0" - "@webpack-cli/info" "^1.5.0" - "@webpack-cli/serve" "^1.7.0" + "@webpack-cli/configtest" "^2.0.0" + "@webpack-cli/info" "^2.0.0" + "@webpack-cli/serve" "^2.0.0" colorette "^2.0.14" - commander "^7.0.0" + commander "^9.4.1" cross-spawn "^7.0.3" + envinfo "^7.7.3" fastest-levenshtein "^1.0.12" import-local "^3.0.2" - interpret "^2.2.0" - rechoir "^0.7.0" + interpret "^3.1.1" + rechoir "^0.8.0" webpack-merge "^5.7.3" webpack-merge@^5.7.3: diff --git a/client/src/community/index.tsx b/client/src/community/index.tsx index f30421fe29c1..6cdc7fac8ce3 100644 --- a/client/src/community/index.tsx +++ b/client/src/community/index.tsx @@ -13,7 +13,7 @@ export function Contribute() {
-

Community for a better Web

+

Community for a better web

    {STATS.map((s) => (
  • @@ -50,7 +50,7 @@ export function Contribute() { Product Advisory Board {" "} (PAB). MDN is an influential resource and the PAB helps ensure that - MDN’s influence puts the Web first, not any one vendor or + MDN’s influence puts the web first, not any one vendor or organization, and respects the needs of web developers across the industry. Each quarter, the PAB meets to discuss problems, prioritize content creation, and make connections for future collaborations. @@ -127,16 +127,18 @@ export function Contribute() { MDN's resources are entirely available under various open source licenses. Detailed information on licensing for reuse of MDN content, especially regarding copyrights and attribution, can be found{" "} - here. + + here. +

    How to contribute

    We are an open community of developers building resources for a better - Web, regardless of brand, browser, or platform. Anyone can contribute + web, regardless of brand, browser, or platform. Anyone can contribute and each person who does makes us stronger. Together we can continue - to drive innovation on the Web to serve the greater good. It starts - here, with you. Please,{" "} - join us! + to drive innovation on the web to serve the greater good. It starts + here, with you. + Join us!

    No matter your specific level of expertise, individual strengths and @@ -147,10 +149,9 @@ export function Contribute() { Ready to become an active part of the MDN community but not sure where to begin? We've got you covered. See our step-by-step directions to{" "} making your first contribution to MDN on GitHub diff --git a/client/src/document/index.scss b/client/src/document/index.scss index c39047b0692a..7cec61e05032 100644 --- a/client/src/document/index.scss +++ b/client/src/document/index.scss @@ -424,6 +424,7 @@ code, code { background: var(--code-background-inline); + font-family: var(--font-code); padding: 0.125rem 0.25rem; width: fit-content; } diff --git a/client/src/document/ingredients/browser-compatibility-table/feature-row.tsx b/client/src/document/ingredients/browser-compatibility-table/feature-row.tsx index e6e574ff995d..e7e74eb2c413 100644 --- a/client/src/document/ingredients/browser-compatibility-table/feature-row.tsx +++ b/client/src/document/ingredients/browser-compatibility-table/feature-row.tsx @@ -135,7 +135,7 @@ const CellText = React.memo( const currentSupport = getCurrentSupport(support); const added = currentSupport?.version_added ?? null; - const removed = currentSupport?.version_removed ?? null; + const lastVersion = currentSupport?.version_last ?? null; const browserReleaseDate = getSupportBrowserReleaseDate(support); const supportClassName = getSupportClassName(support, browser); @@ -151,7 +151,7 @@ const CellText = React.memo( status = { isSupported: "unknown" }; break; case true: - status = { isSupported: removed ? "no" : "yes" }; + status = { isSupported: lastVersion ? "no" : "yes" }; break; case false: status = { isSupported: "no" }; @@ -162,7 +162,7 @@ const CellText = React.memo( default: status = { isSupported: supportClassName, - label: versionLabelFromSupport(added, removed, browser), + label: versionLabelFromSupport(added, lastVersion, browser), }; break; } diff --git a/client/src/document/ingredients/browser-compatibility-table/index-desktop-md.scss b/client/src/document/ingredients/browser-compatibility-table/index-desktop-md.scss index 9d9eff8e9dec..8fe71876fb26 100644 --- a/client/src/document/ingredients/browser-compatibility-table/index-desktop-md.scss +++ b/client/src/document/ingredients/browser-compatibility-table/index-desktop-md.scss @@ -1,5 +1,5 @@ @media screen and (min-width: $screen-md) { - .table-scroll { + .table-container { width: calc(100% + 6rem); } diff --git a/client/src/document/ingredients/browser-compatibility-table/index-desktop-xl.scss b/client/src/document/ingredients/browser-compatibility-table/index-desktop-xl.scss index 0fcb1567dd74..82a8c1294f72 100644 --- a/client/src/document/ingredients/browser-compatibility-table/index-desktop-xl.scss +++ b/client/src/document/ingredients/browser-compatibility-table/index-desktop-xl.scss @@ -1,10 +1,10 @@ @media screen and (min-width: $screen-xl) { - .table-scroll { + .table-container { margin: 0; width: 100%; } - .table-scroll-inner { + .table-container-inner { padding: 0; } } diff --git a/client/src/document/ingredients/browser-compatibility-table/index-desktop.scss b/client/src/document/ingredients/browser-compatibility-table/index-desktop.scss index b063402d5f1a..5db51b15bb34 100644 --- a/client/src/document/ingredients/browser-compatibility-table/index-desktop.scss +++ b/client/src/document/ingredients/browser-compatibility-table/index-desktop.scss @@ -32,13 +32,13 @@ } } - .table-scroll { + .table-container { margin: 0 -3rem; overflow: auto; width: 100vw; } - .table-scroll-inner { + .table-container-inner { min-width: max-content; padding: 0 3rem; position: relative; diff --git a/client/src/document/ingredients/browser-compatibility-table/index-mobile.scss b/client/src/document/ingredients/browser-compatibility-table/index-mobile.scss index be729b5f0266..4d97c083d859 100644 --- a/client/src/document/ingredients/browser-compatibility-table/index-mobile.scss +++ b/client/src/document/ingredients/browser-compatibility-table/index-mobile.scss @@ -25,7 +25,7 @@ } } - .table-scroll { + .table-container { overflow-x: auto; } } diff --git a/client/src/document/ingredients/browser-compatibility-table/index.tsx b/client/src/document/ingredients/browser-compatibility-table/index.tsx index a50ca4a05dc4..2fd09e518061 100644 --- a/client/src/document/ingredients/browser-compatibility-table/index.tsx +++ b/client/src/document/ingredients/browser-compatibility-table/index.tsx @@ -171,8 +171,8 @@ export default function BrowserCompatibilityTable({ > Report problems with this compatibility data on GitHub -

    -
    +
    +
    @@ -183,8 +183,8 @@ export default function BrowserCompatibilityTable({ />
    -
    -
    + + {/* https://github.com/mdn/yari/issues/1191 */} diff --git a/client/src/document/ingredients/browser-compatibility-table/utils.ts b/client/src/document/ingredients/browser-compatibility-table/utils.ts index 7149e90a1f85..6b20a7060e19 100644 --- a/client/src/document/ingredients/browser-compatibility-table/utils.ts +++ b/client/src/document/ingredients/browser-compatibility-table/utils.ts @@ -6,6 +6,9 @@ interface SimpleSupportStatementExtended extends BCD.SimpleSupportStatement { // Known for some support statements where the browser *version* is known, // as opposed to just "true" and if the version release date is known. release_date?: string; + // The version before the version_removed if the *version* removed is known, + // as opposed to just "true". Otherwise the version_removed. + version_last?: BCD.VersionValue; } export type SupportStatementExtended = diff --git a/client/src/document/ingredients/utils.tsx b/client/src/document/ingredients/utils.tsx index 0987c11e3915..61984f44a40f 100644 --- a/client/src/document/ingredients/utils.tsx +++ b/client/src/document/ingredients/utils.tsx @@ -42,7 +42,6 @@ function Permalink({ return ( ); diff --git a/client/src/document/organisms/sidebar/index.tsx b/client/src/document/organisms/sidebar/index.tsx index e8a8e4a986c0..002fb109bf3e 100644 --- a/client/src/document/organisms/sidebar/index.tsx +++ b/client/src/document/organisms/sidebar/index.tsx @@ -28,6 +28,18 @@ export function SidebarContainer({ doc, children }) { } }, [isSidebarOpen]); + useEffect(() => { + const sidebar = document.querySelector("#sidebar-quicklinks"); + const currentSidebarItem = sidebar?.querySelector("em"); + if (sidebar && currentSidebarItem) { + [sidebar, sidebar.querySelector(".sidebar-inner")].forEach((n) => + n?.scrollTo({ + top: currentSidebarItem.offsetTop - window.innerHeight / 3, + }) + ); + } + }, []); + return ( <>