message: fix(pattern): updated section detection on table-of-contents
  I've updated the behaviour of the scrolling detection, so it now follows the specs, preferring to highlight the first section on screen
diff: @@ -10,7 +10,6 @@ import classNames from 'classnames';
  import { settings as ddsSettings } from '@carbon/ibmdotcom-utilities';
  import Layout from '../Layout/Layout';
  import PropTypes from 'prop-types';
  -import root from 'window-or-global';
  import settings from 'carbon-components/es/globals/js/settings';
  import TOCDesktop from './TOCDesktop';
  import TOCMobile from './TOCMobile';
  @@ -113,10 +112,22 @@ const TableOfContents = ({
  * @returns {string} name attribute
  */
  const getElemsInView = () => {
  - const items = [...document.querySelectorAll('a[name]')].filter(
  - elem => elem.getBoundingClientRect().y <= root.innerHeight / 2
  + const items = [...document.querySelectorAll('a[name]')]
  + .map((elem, index, arr) => ({
  + elem,
  + height: arr[index + 1]
  + ? arr[index + 1].getBoundingClientRect().y -
  + elem.getBoundingClientRect().y
  + : null,
  + position: elem.getBoundingClientRect().y,
  + }))
  + .filter((elem, index, arr) =>
  + elem.height === null
  + ? arr[index - 1].position < arr[index - 1].height
  + : elem.position > -elem.height
  );
  - return items[items.length - 1].getAttribute('name');
  +
  + return items[0].elem.getAttribute('name');
  };
  /**
  