JSFiddle - React, Tailwind, and code Playground

HTML

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Container with Arrows</title>
    <link rel="stylesheet" href="css/styles21.css">
</head>
<body>
    <div class="container-wrapper">
        <div class="container">
            <div class="left-section">
              <input type="text" id="searchStock" placeholder="Search...">
              <a href="#" class="left-arrow" onclick="moveLeft()">◄</a>
              <div id="tabs"></div>
            </div>
            <div class="right-section">
              <a href="#" class="right-arrow" onclick="moveRight()">►</a>
              <a href="#" class="down-arrow" onclick="showTabs()">▼</a>
              <div class="stock-drop-container">
                <ul class="stock-drop-list">
                </ul>
              </div>
              <a href="#" class="sign-in" onclick="signIn()">sign-out</a>
            </div>
        </div>
        <div class="controls">
            <input type="text" id="userInput" placeholder="Type something...">
            <button onclick="addText()">Add Text</button>
        </div>
    </div>
    <script src="js/script21.js"></script>
</body>
</html>

CSS

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body, html {
  width: 100%;
  height: 100%;
}

.container-wrapper {
  width: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.left-section, .right-section {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
}

.container {
  height: 20px;
  width: 100%;
  background-color: blue;
  display: flex;
  align-items: center;
  justify-content: space-between;
}


#searchStock {
  height: 20px;
}

.left-arrow, .right-arrow, .down-arrow  {
  font-size: 10px;
  color: white;
  cursor: pointer;
  padding: 2px 5px;
  margin: 0 0 0 2px;
  text-decoration: none;
  border: 1px solid white;
  display: none;
}

#tabs {
  display: inline-block;
  position: relative;
  overflow: auto;
}

.stock-drop-container {
  position: absolute;
  top: 20px;
  right: 0;
  background-color: #ffffff;
  border: 1px solid #cccccc;
  z-index: 500;
  display: block;
  max-height: 150px;
  overflow-y: auto;
}

.stock-drop-list {
  list-style-type: none;
  padding: 0;
  text-align: right;
}

.stock-drop-list li {
  padding: 8px;
  font-size: 12px;
  cursor: pointer;
}

.stock-drop-list li:hover {
  background-color: #dddddd;
}

.text-item {
  font-size: 12px;
  background-color: white;
  color: black;
  padding: 0 5px;
  margin: 0 0 0 2px;
  float: left;
  /* position: absolute; */
}

.sign-in {
  font-size: 16px;
  color: white;
  cursor: pointer;
  padding: 0 5px;
  white-space: nowrap;
}

.controls {
  margin-top: 20px;
  text-align: center;
}

#userInput {
  padding: 10px;
  font-size: 16px;
}

button {
  padding: 10px 20px;
  margin-left: 10px;
  font-size: 16px;
  cursor: pointer;
}

button:hover {
  background-color: lightblue;
}

JavaScript

let container = document.querySelector('.container');
let searchStock = document.getElementById('searchStock');
var leftArrow = document.querySelector('.left-arrow');
let tabs = document.getElementById('tabs');
let rightArrow = document.querySelector('.right-arrow');
let downArrow = document.querySelector('.down-arrow');
let signin = document.querySelector('.sign-in');
let stockDropContainer = document.querySelector('.stock-drop-container');
let stockDropList = document.querySelector('.stock-drop-list');
let inputField = document.getElementById('userInput');
let tabTexts = [];
let tabTextsWidth = [];
let currentIndex = 0;

function adjustForOverflow(yOffset) {
  var tabList = tabs.children;
  let tabLeft = yOffset;
  for(let i = 0; i < tabList.length; i++) {
    tabList[i].style.top = 0;
    tabList[i].style.left = tabLeft;
    tabLeft += tabTextsWidth[i];
  }
}

function calcWidth(ele) {
  var rect = ele.getBoundingClientRect();

  var width;
  if (rect.width) {
    // `width` is available for IE9+
    width = rect.width;
  } else {
    // Calculate width for IE8 and below
    width = rect.right - rect.left;
  }
  return width;
}

function getStyle(ele, name) {
  return ele.currentStyle ? ele.currentStyle[name] : window.getComputedStyle ? window.getComputedStyle(ele, null).getPropertyValue(name) : null;
}

function checkOverflow() {
  const containerWidth = calcWidth(container);

  const searchStockWidth = calcWidth(searchStock);

  var leftArrowWidth = 0;
  if(getStyle(leftArrow, 'display') === 'none') {
    leftArrow.style.display = 'inline-block';
    leftArrowWidth = calcWidth(leftArrow) + 2; // margin: 0 0 0 2px;
    leftArrow.style.display = 'none';
  } else {
    leftArrowWidth = calcWidth(leftArrow) + 2; // margin: 0 0 0 2px;
  }

  var rightArrowWidth = 0;
  if(getStyle(rightArrow, 'display') === 'none') {
    rightArrow.style.display = 'inline-block';
    rightArrowWidth = calcWidth(rightArrow) + 2; // margin: 0 0 0 2px;
    rightArrow.style.display =...