@financial-times/dotcom-ui-header 10.3.2 → 11.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/browser.js CHANGED
@@ -1,5 +1,6 @@
1
1
  import Header from '@financial-times/o-header'
2
- import TopicSearch from 'n-topic-search'
2
+ import TypeAhead from 'n-topic-search'
3
+ import { h, render } from 'preact'
3
4
 
4
5
  /**
5
6
  * @typedef HeaderOptions
@@ -16,7 +17,29 @@ export const init = (headerOptions = {}) => {
16
17
  '.o-header [data-n-topic-search], .o-header__drawer [data-n-topic-search]'
17
18
  )
18
19
  topicSearchElements.forEach((element) => {
19
- new TopicSearch(element, headerOptions)
20
+ const oheaderContainer = element.parentElement
21
+ const oheaderContainerParent = oheaderContainer?.parentElement
22
+ const isDrawer = oheaderContainerParent?.parentElement?.getAttribute('data-o-header-drawer') === 'true'
23
+
24
+ const form = oheaderContainer?.querySelector('form')
25
+ const input = form?.querySelector('input')
26
+ const typeaheadContainer = document.createElement('div')
27
+ typeaheadContainer.id = `suggestions-${input?.id}`
28
+ typeaheadContainer.className = 'typeahead__main-container'
29
+ typeaheadContainer.role = 'listbox'
30
+
31
+ if (!form || !input) return
32
+
33
+ if (isDrawer) {
34
+ const mobileDrawer = oheaderContainerParent?.parentElement
35
+ element.appendChild(typeaheadContainer)
36
+
37
+ render(<TypeAhead container={mobileDrawer} inputId={input.id} />, typeaheadContainer)
38
+ } else {
39
+ form.after(typeaheadContainer)
40
+
41
+ render(<TypeAhead container={oheaderContainerParent} inputId={input.id} />, typeaheadContainer)
42
+ }
20
43
  })
21
44
 
22
45
  Header.init(headerOptions.rootElement)
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  export interface AskFtButtonProps {
3
3
  id: string;
4
- className: string;
4
+ variant: 'top' | 'drawer';
5
5
  dataTrackable: string;
6
6
  }
7
- export declare const AskFtButton: ({ id, className, dataTrackable }: AskFtButtonProps) => React.JSX.Element;
7
+ export declare const AskFtButton: ({ id, variant, dataTrackable }: AskFtButtonProps) => React.JSX.Element;
@@ -5,7 +5,5 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.AskFtButton = void 0;
7
7
  const react_1 = __importDefault(require("react"));
8
- const AskFtButton = ({ id, className, dataTrackable }) => (react_1.default.createElement("div", { className: "o-header__drawer-actions" },
9
- react_1.default.createElement("a", { id: id, className: `ft-header__ask-ft-button ${className}`, "data-trackable": dataTrackable, href: "https://ask.ft.com", title: "ASK FT" },
10
- react_1.default.createElement("span", { className: "ft-header__ask-ft-button-label" }, "Ask FT"))));
8
+ const AskFtButton = ({ id, variant, dataTrackable }) => (react_1.default.createElement("a", { id: id, className: `o-header__ask-ft-button o-header__ask-ft-button--${variant}`, "data-trackable": dataTrackable, href: "https://ask.ft.com", title: "ASK FT" }, "Ask FT"));
11
9
  exports.AskFtButton = AskFtButton;
@@ -18,7 +18,7 @@ const Drawer = (props) => {
18
18
  react_1.default.createElement("div", { className: "o-header__drawer-inner" },
19
19
  react_1.default.createElement(DrawerTools, Object.assign({}, editions)),
20
20
  react_1.default.createElement(Search, null),
21
- props.showAskButton && (react_1.default.createElement(askFtButton_1.AskFtButton, { className: "ft-header__drawer-ask-ft-button", id: "ask-ft-button-drawer", dataTrackable: "ask-ft-button-drawer" })),
21
+ props.showAskButton && (react_1.default.createElement(askFtButton_1.AskFtButton, { variant: "drawer", dataTrackable: "ask-ft-button-drawer", id: "ask-ft-button-drawer" })),
22
22
  !props.userIsSubscribed && subscribeAction && react_1.default.createElement(additionalPartials_1.SubscribeButton, Object.assign({}, subscribeAction)),
23
23
  react_1.default.createElement("nav", { className: "o-header__drawer-menu o-header__drawer-menu--primary" },
24
24
  primary ? react_1.default.createElement(SectionPrimary, Object.assign({}, primary)) : null,
@@ -30,17 +30,20 @@ const DrawerTools = (editions) => (react_1.default.createElement("div", { classN
30
30
  react_1.default.createElement("button", { type: "button", className: "o-header__drawer-tools-close", title: "Close side navigation menu", "aria-controls": "o-header-drawer", "data-trackable": "close" },
31
31
  react_1.default.createElement("span", { className: "o-header__visually-hidden" }, "Close side navigation menu")),
32
32
  editions && react_1.default.createElement(additionalPartials_1.EditionsSwitcher, Object.assign({}, editions))));
33
- const Search = () => (react_1.default.createElement("div", { className: "o-header__drawer-search" },
34
- react_1.default.createElement("form", { className: "o-header__drawer-search-form", action: "/search", role: "search", "aria-label": "Site search", "data-n-topic-search": true, "data-n-topic-search-categories": "concepts,equities", "data-n-topic-search-view-all": true },
35
- react_1.default.createElement("label", { htmlFor: "o-header-drawer-search-term", className: "o-forms-field o-forms-field--optional" },
36
- react_1.default.createElement("span", { className: "o-forms-title o-header__visually-hidden" },
37
- react_1.default.createElement("span", { className: "o-forms-title__main" },
38
- "Search the ",
39
- react_1.default.createElement("abbr", { title: "Financial Times" }, "FT"))),
40
- react_1.default.createElement("span", { className: "o-forms-input o-forms-input--text o-forms-input--suffix" },
41
- react_1.default.createElement("input", { id: "o-header-drawer-search-term", name: "q", type: "text", autoComplete: "off", autoCorrect: "off", autoCapitalize: "off", spellCheck: false, "data-trackable": "search-term", "data-n-topic-search-input": true, placeholder: "Search for stories, topics or securities" }),
42
- react_1.default.createElement("button", { className: "o-header__drawer-search-submit", type: "submit", "data-trackable": "search-submit" },
43
- react_1.default.createElement("span", { className: "o-header__visually-hidden" }, "Search")))))));
33
+ const Search = () => {
34
+ const inputId = 'o-header-drawer-search-term';
35
+ return (react_1.default.createElement("div", { className: "o-header__drawer-search" },
36
+ react_1.default.createElement("form", { className: "o-header__drawer-search-form", action: "/search", role: "search", "aria-label": "Site search", "data-n-topic-search": true },
37
+ react_1.default.createElement("label", { htmlFor: inputId, className: "o-forms-field o-forms-field--optional" },
38
+ react_1.default.createElement("span", { className: "o-forms-title o-header__visually-hidden" },
39
+ react_1.default.createElement("span", { className: "o-forms-title__main" },
40
+ "Search the ",
41
+ react_1.default.createElement("abbr", { title: "Financial Times" }, "FT"))),
42
+ react_1.default.createElement("span", { className: "o-forms-input o-forms-input--text o-forms-input--suffix" },
43
+ react_1.default.createElement("input", { id: inputId, name: "q", type: "search", autoComplete: "off", autoCorrect: "off", autoCapitalize: "off", spellCheck: false, "data-trackable": "search-term", "data-n-topic-search-input": true, placeholder: "Search for stories, topics or securities", role: "combobox", "aria-controls": `suggestions-${inputId}`, "data-n-topic-search-drawer": "true" }),
44
+ react_1.default.createElement("button", { className: "o-header__drawer-search-submit", type: "submit", "data-trackable": "search-submit" },
45
+ react_1.default.createElement("span", { className: "o-header__visually-hidden" }, "Search")))))));
46
+ };
44
47
  const SectionPrimary = (props) => {
45
48
  var _a;
46
49
  const sectionId = props.label.toLowerCase().replace(' ', '-');
@@ -6,18 +6,22 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.Search = void 0;
7
7
  const react_1 = __importDefault(require("react"));
8
8
  const Search = ({ instance }) => {
9
+ const inputId = `o-header-search-term-${instance}`;
9
10
  return (react_1.default.createElement("div", { id: `o-header-search-${instance}`, className: `o-header__row o-header__search o-header__search--${instance}`, "data-trackable": "header-search", "data-o-header-search": true },
10
11
  react_1.default.createElement("div", { className: "o-header__container" },
11
- react_1.default.createElement("form", { className: "o-header__search-form", action: "/search", role: "search", "aria-label": "Site search", "data-n-topic-search": true, "data-n-topic-search-categories": "concepts,equities", "data-n-topic-search-view-all": true },
12
- react_1.default.createElement("label", { htmlFor: `o-header-search-term-${instance}`, className: "o-header__search-term o-forms-field o-forms-field--optional" },
12
+ react_1.default.createElement("form", { className: "o-header__search-form", action: "/search", role: "search", "aria-label": "Site search", "data-n-topic-search": true },
13
+ react_1.default.createElement("label", { htmlFor: inputId, className: "o-header__search-term o-forms-field o-forms-field--optional" },
13
14
  react_1.default.createElement("span", { className: "o-forms-title o-header__visually-hidden" },
14
15
  react_1.default.createElement("span", { className: "o-forms-title__main" },
15
16
  "Search the ",
16
17
  react_1.default.createElement("abbr", { title: "Financial Times" }, "FT"))),
17
18
  react_1.default.createElement("span", { className: "o-forms-input o-forms-input--text o-forms-input--suffix" },
18
- react_1.default.createElement("input", { className: "o-header__search-term", id: `o-header-search-term-${instance}`, name: "q", type: "text", autoComplete: "off", autoCorrect: "off", autoCapitalize: "off", spellCheck: false, "data-trackable": "search-term", "data-n-topic-search-input": true, placeholder: "Search for stories, topics or securities" }),
19
- react_1.default.createElement("button", { className: "o-header__search-submit", type: "submit" }, "Search"),
19
+ react_1.default.createElement("input", { id: inputId, name: "q", type: "search", autoComplete: "off", autoCorrect: "off", autoCapitalize: "off", spellCheck: false, placeholder: "Search for stories, topics or securities", role: "combobox", "aria-controls": `suggestions-${inputId}` }),
20
+ react_1.default.createElement("button", { className: "o-header__search-submit", type: "submit" },
21
+ react_1.default.createElement("span", { "aria-hidden": "true", className: "o-header__search-icon" }),
22
+ react_1.default.createElement("span", null, "Search")),
20
23
  react_1.default.createElement("button", { className: "o-header__search-close o--if-js", type: "button", "aria-controls": `o-header-search-${instance}`, title: "Close search bar", "data-trackable": "close" },
21
- react_1.default.createElement("span", { className: "o-header__visually-hidden" }, "Close search bar"))))))));
24
+ react_1.default.createElement("span", { className: "o-header__visually-hidden" }, "Close search bar"),
25
+ react_1.default.createElement("span", null, "Close"))))))));
22
26
  };
23
27
  exports.Search = Search;
@@ -32,7 +32,7 @@ const TopColumnLeftSticky = (props) => {
32
32
  return (react_1.default.createElement("div", { className: "o-header__top-column o-header__top-column--left" },
33
33
  react_1.default.createElement(DrawerIconSticky, null),
34
34
  react_1.default.createElement(SearchIconSticky, null),
35
- props.showAskButton && (react_1.default.createElement(askFtButton_1.AskFtButton, { className: "ft-header__top-ask-ft-button", id: "ask-ft-button-sticky", dataTrackable: "ask-ft-button-sticky" }))));
35
+ props.showAskButton && (react_1.default.createElement(askFtButton_1.AskFtButton, { variant: "top", dataTrackable: "ask-ft-button-sticky", id: "ask-ft-button-sticky" }))));
36
36
  };
37
37
  exports.TopColumnLeftSticky = TopColumnLeftSticky;
38
38
  const TopColumnCenterSticky = (props) => {
@@ -27,7 +27,7 @@ exports.TopWrapper = TopWrapper;
27
27
  const TopColumnLeft = (props) => (react_1.default.createElement("div", { className: "o-header__top-column o-header__top-column--left" },
28
28
  react_1.default.createElement(DrawerIcon, null),
29
29
  react_1.default.createElement(SearchIcon, null),
30
- props.showAskButton && (react_1.default.createElement(askFtButton_1.AskFtButton, { className: "ft-header__top-ask-ft-button", id: "ask-ft-button-header", dataTrackable: "ask-ft-button-header" }))));
30
+ props.showAskButton && (react_1.default.createElement(askFtButton_1.AskFtButton, { variant: "top", dataTrackable: "ask-ft-button-header", id: "ask-ft-button-header" }))));
31
31
  exports.TopColumnLeft = TopColumnLeft;
32
32
  const TopColumnCenter = () => (react_1.default.createElement("div", { className: "o-header__top-column o-header__top-column--center" },
33
33
  react_1.default.createElement("a", { className: "o-header__top-logo", style: { backgroundImage: 'none' }, "data-trackable": "logo", href: "/", title: "Go to Financial Times homepage" },
@@ -182,12 +182,12 @@
182
182
  "affectsGlobalScope": false
183
183
  },
184
184
  "../src/components/ask-ft/askFtButton.tsx": {
185
- "version": "a827235e62e71862d2899c28707befaca960138bafadc50f71a5feac74294f61",
186
- "signature": "478e79eef989a22fe3dc976337d53a5e3ea146b07304c45620b8b91560dd106b",
185
+ "version": "e64ae88724dad2d4da7b35d7940e1577ebf43abbbae97a865d60ef09b3d1504d",
186
+ "signature": "dfec79c572502e515a70389181784d0ac90bdb70693e76820b3fdd04bf176ecc",
187
187
  "affectsGlobalScope": false
188
188
  },
189
189
  "../src/components/top/partials.tsx": {
190
- "version": "f40214092408dfe8a12e842668caa94faecb31b460d015e34567e5dcc1445307",
190
+ "version": "6a03f79c6e07e80c005313ff4b918443f15fcf628b685faa727c98c03742e58d",
191
191
  "signature": "76906372a1b286f93aa80f146a97782d3fa965ceb5e5314d8ae9da20ac3aa28c",
192
192
  "affectsGlobalScope": false
193
193
  },
@@ -202,7 +202,7 @@
202
202
  "affectsGlobalScope": false
203
203
  },
204
204
  "../src/components/sticky/partials.tsx": {
205
- "version": "77aadd42305d77b0692de540e5ecde571dbcae237489a2631a874f5bbcead2b6",
205
+ "version": "a1fda4543af3876ab17becf355fb70b9532b2e90ae1584a25122a9552b01d171",
206
206
  "signature": "8fbeb8e68c5be0e2f41a60731bb91f6c54327ecca0d18857c3feeaa06e1cd389",
207
207
  "affectsGlobalScope": false
208
208
  },
@@ -217,12 +217,12 @@
217
217
  "affectsGlobalScope": false
218
218
  },
219
219
  "../src/components/drawer/topLevelPartials.tsx": {
220
- "version": "7310d5c055bea7e85677276877bf82cf04d9b472eaf0189c9cae8876ce05c844",
220
+ "version": "2eb7036c49b2297a7afb7aca1dc20c6f8d5cd5ebbc4e17d811622320012efe4a",
221
221
  "signature": "9d1b0a09950f10403acbd59a85db578c3d6d0eec6d4fd6b26deacd7fc69b5bb4",
222
222
  "affectsGlobalScope": false
223
223
  },
224
224
  "../src/components/search/partials.tsx": {
225
- "version": "f2a8b056d48b25b6211e0975fef8fa78fd4160caeb89b0afe70a1b8339092181",
225
+ "version": "360e4452a282c9a415b1dd7621ea107a159d1144a471bf3df6f1c877ec7cf3be",
226
226
  "signature": "95cc7b856ca35f4cf26ee51afe536bfedb47e2bf354d9dc0d25e2d57f96d848e",
227
227
  "affectsGlobalScope": false
228
228
  },
@@ -237,8 +237,8 @@
237
237
  "affectsGlobalScope": false
238
238
  },
239
239
  "../../../node_modules/@babel/types/lib/index.d.ts": {
240
- "version": "f713064ca751dc588bc13832137c418cb70cf0446de92ade60ad631071558fca",
241
- "signature": "f713064ca751dc588bc13832137c418cb70cf0446de92ade60ad631071558fca",
240
+ "version": "e74998d5cefc2f29d583c10b99c1478fb810f1e46fbb06535bfb0bbba3c84aa5",
241
+ "signature": "e74998d5cefc2f29d583c10b99c1478fb810f1e46fbb06535bfb0bbba3c84aa5",
242
242
  "affectsGlobalScope": false
243
243
  },
244
244
  "../../../node_modules/@types/babel__generator/index.d.ts": {
@@ -247,8 +247,8 @@
247
247
  "affectsGlobalScope": false
248
248
  },
249
249
  "../../../node_modules/@babel/parser/typings/babel-parser.d.ts": {
250
- "version": "96c23535f4f9dd15beb767e070559ea672f6a35f103152836a67100605136a96",
251
- "signature": "96c23535f4f9dd15beb767e070559ea672f6a35f103152836a67100605136a96",
250
+ "version": "43d058146b002d075f5d0033a6870321048297f1658eb0db559ba028383803a6",
251
+ "signature": "43d058146b002d075f5d0033a6870321048297f1658eb0db559ba028383803a6",
252
252
  "affectsGlobalScope": false
253
253
  },
254
254
  "../../../node_modules/@types/babel__template/index.d.ts": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@financial-times/dotcom-ui-header",
3
- "version": "10.3.2",
3
+ "version": "11.0.0",
4
4
  "description": "",
5
5
  "browser": "browser.js",
6
6
  "main": "component.js",
@@ -22,8 +22,8 @@
22
22
  "author": "",
23
23
  "license": "MIT",
24
24
  "dependencies": {
25
- "@financial-times/dotcom-types-navigation": "^10.3.2",
26
- "n-topic-search": "^4.0.0"
25
+ "@financial-times/dotcom-types-navigation": "^11.0.0",
26
+ "n-topic-search": "^8.0.0"
27
27
  },
28
28
  "devDependencies": {
29
29
  "@financial-times/logo-images": "^1.10.1",
@@ -33,7 +33,7 @@
33
33
  },
34
34
  "peerDependencies": {
35
35
  "@financial-times/logo-images": "^1.10.1",
36
- "@financial-times/o-header": "13.0.3",
36
+ "@financial-times/o-header": "^14.0.1",
37
37
  "n-ui-foundations": "^9.0.0 || ^10.0.0",
38
38
  "react": "17.x || 18.x",
39
39
  "react-dom": "17.x || 18.x"
@@ -1,5 +1,5 @@
1
1
  import React from 'react'
2
- import * as header from '../../browser.js'
2
+ import Header from '@financial-times/o-header'
3
3
  import { OnReady } from '../../../../.storybook/components/OnReady'
4
4
  import {
5
5
  Header as HeaderSimple,
@@ -15,10 +15,7 @@ import '../../styles.scss'
15
15
  import './demos.scss'
16
16
 
17
17
  const onReadyCallback = () => {
18
- // Passing a cors-anywhere hostname to n-topic-search
19
- // An 'origin' request header will be set on the subsequent fetch request to next-search-api
20
- // This satisfies the api's cors rules allowing a response to be sent and rendered on localhost
21
- header.init({ hostName: 'cors-anywhere.herokuapp.com/www.ft.com' })
18
+ Header.init()
22
19
  }
23
20
 
24
21
  export default {
@@ -98,7 +95,7 @@ LargeHeaderWithDrawer.args = {
98
95
  }
99
96
 
100
97
  export const _StickyHeader = (args) => (
101
- <OnReady callback={() => header.init()}>
98
+ <OnReady callback={onReadyCallback}>
102
99
  <StickyHeader {...storyData} {...args} />
103
100
  <p className="demo-sticky-message demo-sticky-message--scroll">Scroll down</p>
104
101
  </OnReady>
@@ -0,0 +1,45 @@
1
+ /**
2
+ * @jest-environment jsdom
3
+ */
4
+ import React from 'react'
5
+ import { render, screen } from '@testing-library/react'
6
+ import '@testing-library/jest-dom'
7
+ import fixture from '../../__stories__/story-data/index'
8
+ import { Drawer, MainHeader } from '../../index'
9
+
10
+ const propsAnonymous = { ...fixture, userIsAnonymous: true, userIsLoggedIn: false }
11
+
12
+ const components = [
13
+ { name: 'Drawer', Component: Drawer },
14
+ { name: 'MainHeader', Component: MainHeader }
15
+ ]
16
+
17
+ describe('page-kit-header and typeahead (n-topic-search) integration', () => {
18
+ components.forEach(({ name, Component }) => {
19
+ describe(`${name} component`, () => {
20
+ it(`should render the Typeahead component with the correct attribute that indicates the input field is inside the ${name.toLowerCase()}`, () => {
21
+ render(<Component {...propsAnonymous} />)
22
+ const searchInput = screen.getByRole('combobox')
23
+
24
+ expect(searchInput).toBeInTheDocument()
25
+ expect(searchInput).toHaveAttribute('type', 'search')
26
+ })
27
+
28
+ it('should semantically connect the suggestions wrapper by setting aria-controls attribute', () => {
29
+ render(<Component {...propsAnonymous} />)
30
+ const searchInput = screen.getByRole('combobox')
31
+
32
+ expect(searchInput).toHaveAttribute('aria-controls', `suggestions-${searchInput.id}`)
33
+ })
34
+
35
+ if (name === 'Drawer') {
36
+ it('should indicate that search input belongs inside a drawer', () => {
37
+ render(<Component {...propsAnonymous} />)
38
+ const searchInput = screen.getByRole('combobox')
39
+
40
+ expect(searchInput).toHaveAttribute('data-n-topic-search-drawer')
41
+ })
42
+ }
43
+ })
44
+ })
45
+ })
@@ -64,8 +64,6 @@ exports[`dotcom-ui-header/src/components/Drawer renders ASK FT button 1`] = `
64
64
  aria-label="Site search"
65
65
  className="o-header__drawer-search-form"
66
66
  data-n-topic-search={true}
67
- data-n-topic-search-categories="concepts,equities"
68
- data-n-topic-search-view-all={true}
69
67
  role="search"
70
68
  >
71
69
  <label
@@ -90,16 +88,19 @@ exports[`dotcom-ui-header/src/components/Drawer renders ASK FT button 1`] = `
90
88
  className="o-forms-input o-forms-input--text o-forms-input--suffix"
91
89
  >
92
90
  <input
91
+ aria-controls="suggestions-o-header-drawer-search-term"
93
92
  autoCapitalize="off"
94
93
  autoComplete="off"
95
94
  autoCorrect="off"
95
+ data-n-topic-search-drawer="true"
96
96
  data-n-topic-search-input={true}
97
97
  data-trackable="search-term"
98
98
  id="o-header-drawer-search-term"
99
99
  name="q"
100
100
  placeholder="Search for stories, topics or securities"
101
+ role="combobox"
101
102
  spellCheck={false}
102
- type="text"
103
+ type="search"
103
104
  />
104
105
  <button
105
106
  className="o-header__drawer-search-submit"
@@ -116,23 +117,15 @@ exports[`dotcom-ui-header/src/components/Drawer renders ASK FT button 1`] = `
116
117
  </label>
117
118
  </form>
118
119
  </div>
119
- <div
120
- className="o-header__drawer-actions"
120
+ <a
121
+ className="o-header__ask-ft-button o-header__ask-ft-button--drawer"
122
+ data-trackable="ask-ft-button-drawer"
123
+ href="https://ask.ft.com"
124
+ id="ask-ft-button-drawer"
125
+ title="ASK FT"
121
126
  >
122
- <a
123
- className="ft-header__ask-ft-button ft-header__drawer-ask-ft-button"
124
- data-trackable="ask-ft-button-drawer"
125
- href="https://ask.ft.com"
126
- id="ask-ft-button-drawer"
127
- title="ASK FT"
128
- >
129
- <span
130
- className="ft-header__ask-ft-button-label"
131
- >
132
- Ask FT
133
- </span>
134
- </a>
135
- </div>
127
+ Ask FT
128
+ </a>
136
129
  <div
137
130
  className="o-header__drawer-actions"
138
131
  >
@@ -1441,8 +1434,6 @@ exports[`dotcom-ui-header/src/components/Drawer renders as a logged in user 1`]
1441
1434
  aria-label="Site search"
1442
1435
  className="o-header__drawer-search-form"
1443
1436
  data-n-topic-search={true}
1444
- data-n-topic-search-categories="concepts,equities"
1445
- data-n-topic-search-view-all={true}
1446
1437
  role="search"
1447
1438
  >
1448
1439
  <label
@@ -1467,16 +1458,19 @@ exports[`dotcom-ui-header/src/components/Drawer renders as a logged in user 1`]
1467
1458
  className="o-forms-input o-forms-input--text o-forms-input--suffix"
1468
1459
  >
1469
1460
  <input
1461
+ aria-controls="suggestions-o-header-drawer-search-term"
1470
1462
  autoCapitalize="off"
1471
1463
  autoComplete="off"
1472
1464
  autoCorrect="off"
1465
+ data-n-topic-search-drawer="true"
1473
1466
  data-n-topic-search-input={true}
1474
1467
  data-trackable="search-term"
1475
1468
  id="o-header-drawer-search-term"
1476
1469
  name="q"
1477
1470
  placeholder="Search for stories, topics or securities"
1471
+ role="combobox"
1478
1472
  spellCheck={false}
1479
- type="text"
1473
+ type="search"
1480
1474
  />
1481
1475
  <button
1482
1476
  className="o-header__drawer-search-submit"
@@ -2801,8 +2795,6 @@ exports[`dotcom-ui-header/src/components/Drawer renders as an anonymous user 1`]
2801
2795
  aria-label="Site search"
2802
2796
  className="o-header__drawer-search-form"
2803
2797
  data-n-topic-search={true}
2804
- data-n-topic-search-categories="concepts,equities"
2805
- data-n-topic-search-view-all={true}
2806
2798
  role="search"
2807
2799
  >
2808
2800
  <label
@@ -2827,16 +2819,19 @@ exports[`dotcom-ui-header/src/components/Drawer renders as an anonymous user 1`]
2827
2819
  className="o-forms-input o-forms-input--text o-forms-input--suffix"
2828
2820
  >
2829
2821
  <input
2822
+ aria-controls="suggestions-o-header-drawer-search-term"
2830
2823
  autoCapitalize="off"
2831
2824
  autoComplete="off"
2832
2825
  autoCorrect="off"
2826
+ data-n-topic-search-drawer="true"
2833
2827
  data-n-topic-search-input={true}
2834
2828
  data-trackable="search-term"
2835
2829
  id="o-header-drawer-search-term"
2836
2830
  name="q"
2837
2831
  placeholder="Search for stories, topics or securities"
2832
+ role="combobox"
2838
2833
  spellCheck={false}
2839
- type="text"
2834
+ type="search"
2840
2835
  />
2841
2836
  <button
2842
2837
  className="o-header__drawer-search-submit"
@@ -47,23 +47,15 @@ exports[`dotcom-ui-header/src/components/MainHeader renders ASK FT button 1`] =
47
47
  Open search bar
48
48
  </span>
49
49
  </a>
50
- <div
51
- className="o-header__drawer-actions"
50
+ <a
51
+ className="o-header__ask-ft-button o-header__ask-ft-button--top"
52
+ data-trackable="ask-ft-button-header"
53
+ href="https://ask.ft.com"
54
+ id="ask-ft-button-header"
55
+ title="ASK FT"
52
56
  >
53
- <a
54
- className="ft-header__ask-ft-button ft-header__top-ask-ft-button"
55
- data-trackable="ask-ft-button-header"
56
- href="https://ask.ft.com"
57
- id="ask-ft-button-header"
58
- title="ASK FT"
59
- >
60
- <span
61
- className="ft-header__ask-ft-button-label"
62
- >
63
- Ask FT
64
- </span>
65
- </a>
66
- </div>
57
+ Ask FT
58
+ </a>
67
59
  </div>
68
60
  <div
69
61
  className="o-header__top-column o-header__top-column--center"
@@ -132,8 +124,6 @@ exports[`dotcom-ui-header/src/components/MainHeader renders ASK FT button 1`] =
132
124
  aria-label="Site search"
133
125
  className="o-header__search-form"
134
126
  data-n-topic-search={true}
135
- data-n-topic-search-categories="concepts,equities"
136
- data-n-topic-search-view-all={true}
137
127
  role="search"
138
128
  >
139
129
  <label
@@ -158,23 +148,28 @@ exports[`dotcom-ui-header/src/components/MainHeader renders ASK FT button 1`] =
158
148
  className="o-forms-input o-forms-input--text o-forms-input--suffix"
159
149
  >
160
150
  <input
151
+ aria-controls="suggestions-o-header-search-term-primary"
161
152
  autoCapitalize="off"
162
153
  autoComplete="off"
163
154
  autoCorrect="off"
164
- className="o-header__search-term"
165
- data-n-topic-search-input={true}
166
- data-trackable="search-term"
167
155
  id="o-header-search-term-primary"
168
156
  name="q"
169
157
  placeholder="Search for stories, topics or securities"
158
+ role="combobox"
170
159
  spellCheck={false}
171
- type="text"
160
+ type="search"
172
161
  />
173
162
  <button
174
163
  className="o-header__search-submit"
175
164
  type="submit"
176
165
  >
177
- Search
166
+ <span
167
+ aria-hidden="true"
168
+ className="o-header__search-icon"
169
+ />
170
+ <span>
171
+ Search
172
+ </span>
178
173
  </button>
179
174
  <button
180
175
  aria-controls="o-header-search-primary"
@@ -188,6 +183,9 @@ exports[`dotcom-ui-header/src/components/MainHeader renders ASK FT button 1`] =
188
183
  >
189
184
  Close search bar
190
185
  </span>
186
+ <span>
187
+ Close
188
+ </span>
191
189
  </button>
192
190
  </span>
193
191
  </label>
@@ -1987,8 +1985,6 @@ exports[`dotcom-ui-header/src/components/MainHeader renders a right aligned subn
1987
1985
  aria-label="Site search"
1988
1986
  className="o-header__search-form"
1989
1987
  data-n-topic-search={true}
1990
- data-n-topic-search-categories="concepts,equities"
1991
- data-n-topic-search-view-all={true}
1992
1988
  role="search"
1993
1989
  >
1994
1990
  <label
@@ -2013,23 +2009,28 @@ exports[`dotcom-ui-header/src/components/MainHeader renders a right aligned subn
2013
2009
  className="o-forms-input o-forms-input--text o-forms-input--suffix"
2014
2010
  >
2015
2011
  <input
2012
+ aria-controls="suggestions-o-header-search-term-primary"
2016
2013
  autoCapitalize="off"
2017
2014
  autoComplete="off"
2018
2015
  autoCorrect="off"
2019
- className="o-header__search-term"
2020
- data-n-topic-search-input={true}
2021
- data-trackable="search-term"
2022
2016
  id="o-header-search-term-primary"
2023
2017
  name="q"
2024
2018
  placeholder="Search for stories, topics or securities"
2019
+ role="combobox"
2025
2020
  spellCheck={false}
2026
- type="text"
2021
+ type="search"
2027
2022
  />
2028
2023
  <button
2029
2024
  className="o-header__search-submit"
2030
2025
  type="submit"
2031
2026
  >
2032
- Search
2027
+ <span
2028
+ aria-hidden="true"
2029
+ className="o-header__search-icon"
2030
+ />
2031
+ <span>
2032
+ Search
2033
+ </span>
2033
2034
  </button>
2034
2035
  <button
2035
2036
  aria-controls="o-header-search-primary"
@@ -2043,6 +2044,9 @@ exports[`dotcom-ui-header/src/components/MainHeader renders a right aligned subn
2043
2044
  >
2044
2045
  Close search bar
2045
2046
  </span>
2047
+ <span>
2048
+ Close
2049
+ </span>
2046
2050
  </button>
2047
2051
  </span>
2048
2052
  </label>
@@ -3837,8 +3841,6 @@ exports[`dotcom-ui-header/src/components/MainHeader renders as a logged in user
3837
3841
  aria-label="Site search"
3838
3842
  className="o-header__search-form"
3839
3843
  data-n-topic-search={true}
3840
- data-n-topic-search-categories="concepts,equities"
3841
- data-n-topic-search-view-all={true}
3842
3844
  role="search"
3843
3845
  >
3844
3846
  <label
@@ -3863,23 +3865,28 @@ exports[`dotcom-ui-header/src/components/MainHeader renders as a logged in user
3863
3865
  className="o-forms-input o-forms-input--text o-forms-input--suffix"
3864
3866
  >
3865
3867
  <input
3868
+ aria-controls="suggestions-o-header-search-term-primary"
3866
3869
  autoCapitalize="off"
3867
3870
  autoComplete="off"
3868
3871
  autoCorrect="off"
3869
- className="o-header__search-term"
3870
- data-n-topic-search-input={true}
3871
- data-trackable="search-term"
3872
3872
  id="o-header-search-term-primary"
3873
3873
  name="q"
3874
3874
  placeholder="Search for stories, topics or securities"
3875
+ role="combobox"
3875
3876
  spellCheck={false}
3876
- type="text"
3877
+ type="search"
3877
3878
  />
3878
3879
  <button
3879
3880
  className="o-header__search-submit"
3880
3881
  type="submit"
3881
3882
  >
3882
- Search
3883
+ <span
3884
+ aria-hidden="true"
3885
+ className="o-header__search-icon"
3886
+ />
3887
+ <span>
3888
+ Search
3889
+ </span>
3883
3890
  </button>
3884
3891
  <button
3885
3892
  aria-controls="o-header-search-primary"
@@ -3893,6 +3900,9 @@ exports[`dotcom-ui-header/src/components/MainHeader renders as a logged in user
3893
3900
  >
3894
3901
  Close search bar
3895
3902
  </span>
3903
+ <span>
3904
+ Close
3905
+ </span>
3896
3906
  </button>
3897
3907
  </span>
3898
3908
  </label>
@@ -5692,8 +5702,6 @@ exports[`dotcom-ui-header/src/components/MainHeader renders as an anonymous user
5692
5702
  aria-label="Site search"
5693
5703
  className="o-header__search-form"
5694
5704
  data-n-topic-search={true}
5695
- data-n-topic-search-categories="concepts,equities"
5696
- data-n-topic-search-view-all={true}
5697
5705
  role="search"
5698
5706
  >
5699
5707
  <label
@@ -5718,23 +5726,28 @@ exports[`dotcom-ui-header/src/components/MainHeader renders as an anonymous user
5718
5726
  className="o-forms-input o-forms-input--text o-forms-input--suffix"
5719
5727
  >
5720
5728
  <input
5729
+ aria-controls="suggestions-o-header-search-term-primary"
5721
5730
  autoCapitalize="off"
5722
5731
  autoComplete="off"
5723
5732
  autoCorrect="off"
5724
- className="o-header__search-term"
5725
- data-n-topic-search-input={true}
5726
- data-trackable="search-term"
5727
5733
  id="o-header-search-term-primary"
5728
5734
  name="q"
5729
5735
  placeholder="Search for stories, topics or securities"
5736
+ role="combobox"
5730
5737
  spellCheck={false}
5731
- type="text"
5738
+ type="search"
5732
5739
  />
5733
5740
  <button
5734
5741
  className="o-header__search-submit"
5735
5742
  type="submit"
5736
5743
  >
5737
- Search
5744
+ <span
5745
+ aria-hidden="true"
5746
+ className="o-header__search-icon"
5747
+ />
5748
+ <span>
5749
+ Search
5750
+ </span>
5738
5751
  </button>
5739
5752
  <button
5740
5753
  aria-controls="o-header-search-primary"
@@ -5748,6 +5761,9 @@ exports[`dotcom-ui-header/src/components/MainHeader renders as an anonymous user
5748
5761
  >
5749
5762
  Close search bar
5750
5763
  </span>
5764
+ <span>
5765
+ Close
5766
+ </span>
5751
5767
  </button>
5752
5768
  </span>
5753
5769
  </label>
@@ -46,23 +46,15 @@ exports[`dotcom-ui-header/src/components/StickyHeader renders ASK FT button 1`]
46
46
  Search
47
47
  </span>
48
48
  </a>
49
- <div
50
- className="o-header__drawer-actions"
49
+ <a
50
+ className="o-header__ask-ft-button o-header__ask-ft-button--top"
51
+ data-trackable="ask-ft-button-sticky"
52
+ href="https://ask.ft.com"
53
+ id="ask-ft-button-sticky"
54
+ title="ASK FT"
51
55
  >
52
- <a
53
- className="ft-header__ask-ft-button ft-header__top-ask-ft-button"
54
- data-trackable="ask-ft-button-sticky"
55
- href="https://ask.ft.com"
56
- id="ask-ft-button-sticky"
57
- title="ASK FT"
58
- >
59
- <span
60
- className="ft-header__ask-ft-button-label"
61
- >
62
- Ask FT
63
- </span>
64
- </a>
65
- </div>
56
+ Ask FT
57
+ </a>
66
58
  </div>
67
59
  <div
68
60
  className="o-header__top-column o-header__top-column--center"
@@ -267,8 +259,6 @@ exports[`dotcom-ui-header/src/components/StickyHeader renders ASK FT button 1`]
267
259
  aria-label="Site search"
268
260
  className="o-header__search-form"
269
261
  data-n-topic-search={true}
270
- data-n-topic-search-categories="concepts,equities"
271
- data-n-topic-search-view-all={true}
272
262
  role="search"
273
263
  >
274
264
  <label
@@ -293,23 +283,28 @@ exports[`dotcom-ui-header/src/components/StickyHeader renders ASK FT button 1`]
293
283
  className="o-forms-input o-forms-input--text o-forms-input--suffix"
294
284
  >
295
285
  <input
286
+ aria-controls="suggestions-o-header-search-term-sticky"
296
287
  autoCapitalize="off"
297
288
  autoComplete="off"
298
289
  autoCorrect="off"
299
- className="o-header__search-term"
300
- data-n-topic-search-input={true}
301
- data-trackable="search-term"
302
290
  id="o-header-search-term-sticky"
303
291
  name="q"
304
292
  placeholder="Search for stories, topics or securities"
293
+ role="combobox"
305
294
  spellCheck={false}
306
- type="text"
295
+ type="search"
307
296
  />
308
297
  <button
309
298
  className="o-header__search-submit"
310
299
  type="submit"
311
300
  >
312
- Search
301
+ <span
302
+ aria-hidden="true"
303
+ className="o-header__search-icon"
304
+ />
305
+ <span>
306
+ Search
307
+ </span>
313
308
  </button>
314
309
  <button
315
310
  aria-controls="o-header-search-sticky"
@@ -323,6 +318,9 @@ exports[`dotcom-ui-header/src/components/StickyHeader renders ASK FT button 1`]
323
318
  >
324
319
  Close search bar
325
320
  </span>
321
+ <span>
322
+ Close
323
+ </span>
326
324
  </button>
327
325
  </span>
328
326
  </label>
@@ -582,8 +580,6 @@ exports[`dotcom-ui-header/src/components/StickyHeader renders as a logged in use
582
580
  aria-label="Site search"
583
581
  className="o-header__search-form"
584
582
  data-n-topic-search={true}
585
- data-n-topic-search-categories="concepts,equities"
586
- data-n-topic-search-view-all={true}
587
583
  role="search"
588
584
  >
589
585
  <label
@@ -608,23 +604,28 @@ exports[`dotcom-ui-header/src/components/StickyHeader renders as a logged in use
608
604
  className="o-forms-input o-forms-input--text o-forms-input--suffix"
609
605
  >
610
606
  <input
607
+ aria-controls="suggestions-o-header-search-term-sticky"
611
608
  autoCapitalize="off"
612
609
  autoComplete="off"
613
610
  autoCorrect="off"
614
- className="o-header__search-term"
615
- data-n-topic-search-input={true}
616
- data-trackable="search-term"
617
611
  id="o-header-search-term-sticky"
618
612
  name="q"
619
613
  placeholder="Search for stories, topics or securities"
614
+ role="combobox"
620
615
  spellCheck={false}
621
- type="text"
616
+ type="search"
622
617
  />
623
618
  <button
624
619
  className="o-header__search-submit"
625
620
  type="submit"
626
621
  >
627
- Search
622
+ <span
623
+ aria-hidden="true"
624
+ className="o-header__search-icon"
625
+ />
626
+ <span>
627
+ Search
628
+ </span>
628
629
  </button>
629
630
  <button
630
631
  aria-controls="o-header-search-sticky"
@@ -638,6 +639,9 @@ exports[`dotcom-ui-header/src/components/StickyHeader renders as a logged in use
638
639
  >
639
640
  Close search bar
640
641
  </span>
642
+ <span>
643
+ Close
644
+ </span>
641
645
  </button>
642
646
  </span>
643
647
  </label>
@@ -896,8 +900,6 @@ exports[`dotcom-ui-header/src/components/StickyHeader renders as an anonymous us
896
900
  aria-label="Site search"
897
901
  className="o-header__search-form"
898
902
  data-n-topic-search={true}
899
- data-n-topic-search-categories="concepts,equities"
900
- data-n-topic-search-view-all={true}
901
903
  role="search"
902
904
  >
903
905
  <label
@@ -922,23 +924,28 @@ exports[`dotcom-ui-header/src/components/StickyHeader renders as an anonymous us
922
924
  className="o-forms-input o-forms-input--text o-forms-input--suffix"
923
925
  >
924
926
  <input
927
+ aria-controls="suggestions-o-header-search-term-sticky"
925
928
  autoCapitalize="off"
926
929
  autoComplete="off"
927
930
  autoCorrect="off"
928
- className="o-header__search-term"
929
- data-n-topic-search-input={true}
930
- data-trackable="search-term"
931
931
  id="o-header-search-term-sticky"
932
932
  name="q"
933
933
  placeholder="Search for stories, topics or securities"
934
+ role="combobox"
934
935
  spellCheck={false}
935
- type="text"
936
+ type="search"
936
937
  />
937
938
  <button
938
939
  className="o-header__search-submit"
939
940
  type="submit"
940
941
  >
941
- Search
942
+ <span
943
+ aria-hidden="true"
944
+ className="o-header__search-icon"
945
+ />
946
+ <span>
947
+ Search
948
+ </span>
942
949
  </button>
943
950
  <button
944
951
  aria-controls="o-header-search-sticky"
@@ -952,6 +959,9 @@ exports[`dotcom-ui-header/src/components/StickyHeader renders as an anonymous us
952
959
  >
953
960
  Close search bar
954
961
  </span>
962
+ <span>
963
+ Close
964
+ </span>
955
965
  </button>
956
966
  </span>
957
967
  </label>
@@ -2,19 +2,18 @@ import React from 'react'
2
2
 
3
3
  export interface AskFtButtonProps {
4
4
  id: string
5
- className: string
5
+ variant: 'top' | 'drawer'
6
6
  dataTrackable: string
7
7
  }
8
8
 
9
- export const AskFtButton = ({ id, className, dataTrackable }: AskFtButtonProps) => (
10
- <div className="o-header__drawer-actions">
11
- <a
12
- id={id}
13
- className={`ft-header__ask-ft-button ${className}`}
14
- data-trackable={dataTrackable}
15
- href="https://ask.ft.com"
16
- title="ASK FT">
17
- <span className="ft-header__ask-ft-button-label">Ask FT</span>
18
- </a>
19
- </div>
9
+ export const AskFtButton = ({ id, variant, dataTrackable }: AskFtButtonProps) => (
10
+ <a
11
+ id={id}
12
+ className={`o-header__ask-ft-button o-header__ask-ft-button--${variant}`}
13
+ data-trackable={dataTrackable}
14
+ href="https://ask.ft.com"
15
+ title="ASK FT"
16
+ >
17
+ Ask FT
18
+ </a>
20
19
  )
@@ -28,16 +28,13 @@ const Drawer = (props: THeaderProps) => {
28
28
  data-o-header-drawer
29
29
  data-o-header-drawer--no-js
30
30
  data-trackable="drawer"
31
- data-trackable-terminate>
31
+ data-trackable-terminate
32
+ >
32
33
  <div className="o-header__drawer-inner">
33
34
  <DrawerTools {...editions} />
34
35
  <Search />
35
36
  {props.showAskButton && (
36
- <AskFtButton
37
- className="ft-header__drawer-ask-ft-button"
38
- id="ask-ft-button-drawer"
39
- dataTrackable="ask-ft-button-drawer"
40
- />
37
+ <AskFtButton variant="drawer" dataTrackable="ask-ft-button-drawer" id="ask-ft-button-drawer" />
41
38
  )}
42
39
  {!props.userIsSubscribed && subscribeAction && <SubscribeButton {...subscribeAction} />}
43
40
  <nav className="o-header__drawer-menu o-header__drawer-menu--primary">
@@ -58,50 +55,56 @@ const DrawerTools = (editions: TNavEditions) => (
58
55
  className="o-header__drawer-tools-close"
59
56
  title="Close side navigation menu"
60
57
  aria-controls="o-header-drawer"
61
- data-trackable="close">
58
+ data-trackable="close"
59
+ >
62
60
  <span className="o-header__visually-hidden">Close side navigation menu</span>
63
61
  </button>
64
62
  {editions && <EditionsSwitcher {...editions} />}
65
63
  </div>
66
64
  )
67
65
 
68
- const Search = () => (
69
- <div className="o-header__drawer-search">
70
- <form
71
- className="o-header__drawer-search-form"
72
- action="/search"
73
- role="search"
74
- aria-label="Site search"
75
- data-n-topic-search
76
- data-n-topic-search-categories="concepts,equities"
77
- data-n-topic-search-view-all>
78
- <label htmlFor="o-header-drawer-search-term" className="o-forms-field o-forms-field--optional">
79
- <span className="o-forms-title o-header__visually-hidden">
80
- <span className="o-forms-title__main">
81
- Search the <abbr title="Financial Times">FT</abbr>
66
+ const Search = () => {
67
+ const inputId = 'o-header-drawer-search-term'
68
+ return (
69
+ <div className="o-header__drawer-search">
70
+ <form
71
+ className="o-header__drawer-search-form"
72
+ action="/search"
73
+ role="search"
74
+ aria-label="Site search"
75
+ data-n-topic-search
76
+ >
77
+ <label htmlFor={inputId} className="o-forms-field o-forms-field--optional">
78
+ <span className="o-forms-title o-header__visually-hidden">
79
+ <span className="o-forms-title__main">
80
+ Search the <abbr title="Financial Times">FT</abbr>
81
+ </span>
82
82
  </span>
83
- </span>
84
- <span className="o-forms-input o-forms-input--text o-forms-input--suffix">
85
- <input
86
- id="o-header-drawer-search-term"
87
- name="q"
88
- type="text"
89
- autoComplete="off"
90
- autoCorrect="off"
91
- autoCapitalize="off"
92
- spellCheck={false}
93
- data-trackable="search-term"
94
- data-n-topic-search-input
95
- placeholder="Search for stories, topics or securities"
96
- />
97
- <button className="o-header__drawer-search-submit" type="submit" data-trackable="search-submit">
98
- <span className="o-header__visually-hidden">Search</span>
99
- </button>
100
- </span>
101
- </label>
102
- </form>
103
- </div>
104
- )
83
+ <span className="o-forms-input o-forms-input--text o-forms-input--suffix">
84
+ <input
85
+ id={inputId}
86
+ name="q"
87
+ type="search"
88
+ autoComplete="off"
89
+ autoCorrect="off"
90
+ autoCapitalize="off"
91
+ spellCheck={false}
92
+ data-trackable="search-term"
93
+ data-n-topic-search-input
94
+ placeholder="Search for stories, topics or securities"
95
+ role="combobox"
96
+ aria-controls={`suggestions-${inputId}`}
97
+ data-n-topic-search-drawer="true"
98
+ />
99
+ <button className="o-header__drawer-search-submit" type="submit" data-trackable="search-submit">
100
+ <span className="o-header__visually-hidden">Search</span>
101
+ </button>
102
+ </span>
103
+ </label>
104
+ </form>
105
+ </div>
106
+ )
107
+ }
105
108
 
106
109
  const SectionPrimary = (props: TNavMenuItem) => {
107
110
  const sectionId = props.label.toLowerCase().replace(' ', '-')
@@ -1,12 +1,14 @@
1
1
  import React from 'react'
2
2
 
3
3
  const Search = ({ instance }) => {
4
+ const inputId = `o-header-search-term-${instance}`
4
5
  return (
5
6
  <div
6
7
  id={`o-header-search-${instance}`}
7
8
  className={`o-header__row o-header__search o-header__search--${instance}`}
8
9
  data-trackable="header-search"
9
- data-o-header-search>
10
+ data-o-header-search
11
+ >
10
12
  <div className="o-header__container">
11
13
  <form
12
14
  className="o-header__search-form"
@@ -14,11 +16,8 @@ const Search = ({ instance }) => {
14
16
  role="search"
15
17
  aria-label="Site search"
16
18
  data-n-topic-search
17
- data-n-topic-search-categories="concepts,equities"
18
- data-n-topic-search-view-all>
19
- <label
20
- htmlFor={`o-header-search-term-${instance}`}
21
- className="o-header__search-term o-forms-field o-forms-field--optional">
19
+ >
20
+ <label htmlFor={inputId} className="o-header__search-term o-forms-field o-forms-field--optional">
22
21
  <span className="o-forms-title o-header__visually-hidden">
23
22
  <span className="o-forms-title__main">
24
23
  Search the <abbr title="Financial Times">FT</abbr>
@@ -26,28 +25,30 @@ const Search = ({ instance }) => {
26
25
  </span>
27
26
  <span className="o-forms-input o-forms-input--text o-forms-input--suffix">
28
27
  <input
29
- className="o-header__search-term"
30
- id={`o-header-search-term-${instance}`}
28
+ id={inputId}
31
29
  name="q"
32
- type="text"
30
+ type="search"
33
31
  autoComplete="off"
34
32
  autoCorrect="off"
35
33
  autoCapitalize="off"
36
34
  spellCheck={false}
37
- data-trackable="search-term"
38
- data-n-topic-search-input
39
35
  placeholder="Search for stories, topics or securities"
36
+ role="combobox"
37
+ aria-controls={`suggestions-${inputId}`}
40
38
  />
41
39
  <button className="o-header__search-submit" type="submit">
42
- Search
40
+ <span aria-hidden="true" className="o-header__search-icon"></span>
41
+ <span>Search</span>
43
42
  </button>
44
43
  <button
45
44
  className="o-header__search-close o--if-js"
46
45
  type="button"
47
46
  aria-controls={`o-header-search-${instance}`}
48
47
  title="Close search bar"
49
- data-trackable="close">
48
+ data-trackable="close"
49
+ >
50
50
  <span className="o-header__visually-hidden">Close search bar</span>
51
+ <span>Close</span>
51
52
  </button>
52
53
  </span>
53
54
  </label>
@@ -88,11 +88,7 @@ const TopColumnLeftSticky = (props: Pick<THeaderProps, 'showAskButton'>) => {
88
88
  <DrawerIconSticky />
89
89
  <SearchIconSticky />
90
90
  {props.showAskButton && (
91
- <AskFtButton
92
- className="ft-header__top-ask-ft-button"
93
- id="ask-ft-button-sticky"
94
- dataTrackable="ask-ft-button-sticky"
95
- />
91
+ <AskFtButton variant="top" dataTrackable="ask-ft-button-sticky" id="ask-ft-button-sticky" />
96
92
  )}
97
93
  </div>
98
94
  )
@@ -79,11 +79,7 @@ const TopColumnLeft = (props: Pick<THeaderProps, 'showAskButton'>) => (
79
79
  <DrawerIcon />
80
80
  <SearchIcon />
81
81
  {props.showAskButton && (
82
- <AskFtButton
83
- className="ft-header__top-ask-ft-button"
84
- id="ask-ft-button-header"
85
- dataTrackable="ask-ft-button-header"
86
- />
82
+ <AskFtButton variant="top" dataTrackable="ask-ft-button-header" id="ask-ft-button-header" />
87
83
  )}
88
84
  </div>
89
85
  )
package/src/header.scss CHANGED
@@ -9,73 +9,19 @@
9
9
  display: block;
10
10
  }
11
11
 
12
- // z-indexes
13
- .o-header__mega {
14
- @include nUiZIndexFor('meganav');
15
- }
16
-
17
- .o-header__drawer {
18
- @include nUiZIndexFor('drawer');
19
- display: block;
20
- .o-header__drawer-search {
21
- margin-bottom: 8px;
22
- }
23
- }
24
-
25
- .o-header--sticky {
26
- @include nUiZIndexFor('sticky-header');
27
- }
28
-
29
12
  // Search typeahead
30
13
  .n-typeahead {
31
14
  display: none;
32
15
  }
33
16
 
34
- .o-header__drawer-search-term {
35
- width: 100%;
36
- }
37
- .o-header__top-wrapper .ft-header__ask-ft-button {
38
- padding: 8px;
39
- }
40
- .ft-header__ask-ft-button {
41
- @include oTypographySans(-1, $weight: 'semibold');
42
- color: oColorsByName('ft-grey');
43
- background-color: oColorsMix('black', 'paper', 5);
44
- border-radius: 4px;
45
- padding-right: 8px;
46
- text-transform: uppercase;
47
- text-decoration: none;
48
- white-space: nowrap;
49
-
50
- &::before {
51
- content: '';
52
- display: block;
53
- @include oIconsContent(
54
- $icon-name: 'sparkles',
55
- $color: oColorsByName('black'),
56
- $size: 32
57
- );
58
- vertical-align: top;
59
- }
60
-
61
- .ft-header__ask-ft-button-label {
62
- display: inline-block;
63
- padding: 8px 0;
64
- line-height: 15px;
65
- }
17
+ // Please remove this rule once the following PR (https://github.com/Financial-Times/origami/pull/1808) is merged and o-header version is updated
18
+ #site-navigation {
19
+ position: relative;
66
20
  }
67
21
 
68
- .ft-header__top-ask-ft-button {
69
- @include oGridRespondTo($until: 'L') {
70
- display: none;
22
+ // Overrides <a> color style set by n-ui-foundations
23
+ .o-header__ask-ft-button {
24
+ &, &:hover {
25
+ color: oColorsByName('black-80');
71
26
  }
72
27
  }
73
-
74
- .ft-header__drawer-ask-ft-button {
75
- display: block;
76
- width: 100%;
77
- box-sizing: border-box;
78
- margin: 0;
79
- text-align: center;
80
-
81
- }
package/styles.scss CHANGED
@@ -1,17 +1,14 @@
1
1
  // This will be overridden by dotcom-ui-layout, it's necessary here for storybook builds
2
2
  $system-code: 'page-kit-header' !default;
3
3
 
4
- @import "n-ui-foundations/mixins";
4
+ @import 'n-ui-foundations/mixins';
5
5
 
6
6
  // We don't need the sub-brand or transparent header styles so disable them.
7
7
  // TODO: move drawer styles into a separate stylesheet which can be lazy loaded?
8
- @import "@financial-times/o-header/main";
8
+ @import '@financial-times/o-header/main';
9
9
  @include oHeader(('top', 'nav', 'subnav', 'search', 'megamenu', 'drawer', 'anon', 'sticky', 'simple'));
10
10
 
11
- @import "src/header";
11
+ @import 'src/header';
12
12
 
13
- @import "n-topic-search/main";
13
+ @import 'n-topic-search/main';
14
14
  @include nTopicSearch;
15
- .o-header__search--primary .n-topic-search, .o-header__search--sticky .n-topic-search {
16
- margin: 24px 0 0;
17
- }