Option list malfunctioning in Safari, Mozilla, as well as Chrome browsers

I encountered some issues while working on the front-end of my web app. Here are a few problems:

  1. I need to truncate text if it's too long, so I use the following CSS:

    .suggestion-box-text { white-space: nowrap; overflow: hidden;
    text-overflow: ellipsis; }

However, in Chrome, I can't use scroll, only keys. 2. Regardless of what I try, Safari remembers the last selected item from the list, and the next time I make a selection, it starts from there instead of the first element.

  1. In addition, nothing seems to work properly in Firefox when I attempt to truncate long text. The scroll still works but when I navigate with keys, the list doesn't scroll.

    Is there a known solution to fix this issue? Or should I keep trying different combinations until I find one that works?

HTML FILE

<div class="navbar-container container-fluid">
        <div class="" id="site-navbar-search">
            <form id="originalSearch" role="search" ng-submit="query()">
                <div class="form-group" style="margin: 15px 0px 0px 0px">
                    <div class="input-search">
                        <speech class=""></speech>

                        <input id="questionForInput" type="text"
                          ng-change="ask.getsuggestions()" autocomplete="off"
                          ng-model="ask.term" class="form-control bg-dark"
                          placeholder="Ask ..." ng-keydown="key($event)"/>

                        <select id="suggestionSelection" class="suggestion-box
                          list-group2 bg-dark" ng-keydown="key2($event)"
                          multiple="multiple"ng-model="ask.term">

                          <option class="list-group-item2 suggestion-box-text bg-dark"
                            ng-repeat="command in ask.suggestions">
                              {{command.statement}}
                          </option>
                        </select>
                        <button type="submit" style="visibility: hidden; display:none"></button>
                    </div>
                </div>
            </form>
        </div>
    </div>

CSS FILE

.suggestion-box {
  overflow: auto;
  overflow: -moz-scrollbars-auto;
  position: absolute;
  z-index: 1;
  width:100%;
  visibility: hidden;
  border-radius: 0px 0px 18px 18px;
  outline: none;
}

.suggestion-box-text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@supports (overflow:-webkit-marquee) and (justify-content:inherit)
{
  .suggestion-box {
      padding-left: 15px;
  }
}


body{
  scrollbar-base-color: #C0C0C0;
  scrollbar-base-color: #C0C0C0;
  scrollbar-3dlight-color: #C0C0C0;
  scrollbar-highlight-color: #C0C0C0;
  scrollbar-track-color: #EBEBEB;
  scrollbar-arrow-color: black;
  scrollbar-shadow-color: #C0C0C0;
  scrollbar-dark-shadow-color: #C0C0C0;
}

::-webkit-scrollbar { width: 0px; height: 0px;}
::-webkit-scrollbar-button {  background-color: #666; }
::-webkit-scrollbar-track {  background-color: #999;}
::-webkit-scrollbar-track-piece { background-color: #ffffff;}
::-webkit-scrollbar-thumb { height: 0px; background-color: #666; border-radius: 0px;}
::-webkit-scrollbar-corner { background-color: #999;}}
::-webkit-resizer { background-color: #666;}

Also part of JS file

$scope.key = function($event){
          if ($event.keyCode == 40) {
            $('#suggestionSelection').focus();
            $('#suggestionSelection').focus();
            //$("select#suggestionSelection").prop('selectedIndex', -1);
            //$("#suggestionSelection")[0].selectedIndex = -1;
          }
          else if($event.keyCode == 27) {
            $('#suggestionSelection').css('visibility', 'hidden');
            $('#questionForInput').css('border-radius', '200px 200px 200px 200px');
          }
        }

        $scope.key2 = function($event){
          console.log($event.keyCode);
          if ($event.keyCode == 38) {
            if($('#suggestionSelection')[0].selectedIndex == -1 || $('#suggestionSelection')[0].selectedIndex == 0) {
              $('#questionForInput').focus();
              $('#suggestionSelection').css('visibility', 'hidden');
              $('#questionForInput').css('border-radius', '200px 200px 200px 200px');
            }
          }
          else if($event.keyCode == 27 || $event.keyCode == 13) {
            $('#questionForInput').focus();
            $('#suggestionSelection').css('visibility', 'hidden');
            $('#questionForInput').css('border-radius', '200px 200px 200px 200px');


          }
        }

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Using Puppeteer and Scrapy, this innovative Web Crawler with Scraper combines the power of both

As a newcomer to web technologies, I am faced with the task of crawling and scraping numerous websites that utilize a combination of React, JavaScript, and HTML. These sites collectively contain approximately 0.1 to 0.5 million pages. My plan is to use Se ...

Tips for improving performance with ng-repeat directive?

I have encountered some performance issues while using socket.io with the ng-repeat directive in Angular. The application slows down significantly when receiving a large amount of data from the backend, making it impossible to interact with the app. What w ...

Utilize code to assess the efficiency of canvas animations

Currently, I am in the process of developing a test platform dedicated to JavaScript performance competitions. Among the various challenges presented to participants, one task involves optimizing JavaScript code that handles a canvas animation. Once a solu ...

Checking for an active listening instance of `http.Server` in a Node application

Having an http server and a piece of code that needs to run only when the server is actively listening, I have bound it to the event "listening" as follows : server.on('listening', doSomething) The issue arises when the server is already listen ...

Using back end proxy for content delivery

I am facing a challenge with my iOS app that requires proxying through a private server (HTTP / HTTPS proxy). Every time I attempt to address this issue on the client-side, new problems arise. How can I use the back end to effectively solve this problem? ...

Is it possible to add my own designs to a three.js model?

I am looking to add some personal touches to my three.js model by drawing on it in the scene. How can I achieve this effect of 'graffiti' on my models within the scene? ...

Creating wrapped text in Three.js

Is there a way to wrap a Text3d object around a 3D or 2D Path in Three.js? I have looked into some tutorials for r.49 of Three.js and it appears that the current version does not have support for this feature. While I am able to create the text and extru ...

How can I ensure that my image remains responsive and aspect ratio-friendly?

Is there a way to accomplish this magical effect? I find myself in a similar situation. I require an image that remains centered while adjusting to fit the screen, all while maintaining its aspect ratio. ...

What is the best way to include the border-radius CSS property to a dropdown element in Ant Design?

Adding the border-radius CSS property to my dropdown component from ant design has been a bit challenging for me. I attempted to modify the antd-css file and include a style object directly into the component, but unfortunately, I did not achieve the des ...

Is it possible for a controller within a directive in AngularJS to define the ng-model of the directive itself?

Having a directive that utilizes ng-model controller and fetches its model value from the parent controller, "myController", I am seeking guidance on how to enable the consumer to dynamically set the ngModel value as they desire. The directive is designed ...

Solve woff file imports using Rollup

I am currently working on bundling a theme package using Rollup.js. The theme contains some global styles, specifically @font-face. I am importing the fonts and planning to inject them using styled-components injectGlobal. However, I am encountering an is ...

Utilizing Conditional HTML/CSS for Enhanced Outlook Emails on Office 365

One interesting feature of Microsoft Outlook is its support for conditional CSS, allowing developers to create markup and styling that is specifically designed to render on Outlook. Despite the claims, I found that the following snippet, intended to be hid ...

Acquiring the input from a text box to generate a hyperlink on the current page

I am trying to generate a link that has the href attribute as follows: app\process?val=12000 The catch is that the value for the val parameter (in this case 12000) needs to be derived from a textbox on the page. I am aware that I can retrieve the ...

Is there a way to have the headline gently fade in and subtly rise when the page loads using CSS?

Is it possible to make the headline fade in and move up slightly on the home page using CSS after the user lands on the website? For a visual reference, check out this example on . I know it can be achieved with translateY, but I have never tried it before ...

Supervising the organization of HTML sections for an offline web application

Currently, I am developing an offline HTML5 application that involves a significant amount of DOM manipulation through the creation of HTML strings within JavaScript functions. For example: var html=''; html+='<div class="main">&apos ...

Encountering a 415 Error while making an ajax call using formData

I am attempting to make an ajax call with formData that includes a list of image files and some strings. However, the call is not successful and I am receiving error 415. Here is the code: var file = picChooser.files[0]; var jobExecutionImagesContext = n ...

Enhancing collapsible list headers in jquery mobile with checkboxes

Having trouble with a jQuery Mobile website issue. Currently working on a jQuery mobile site that includes a collapsible list (). The client request is to have a checkbox inside the header, allowing users to check items off without needing to open them. T ...

What is the correct way to utilize the karma-ng-html2js-preprocessor?

I'm working on a directive called stat24hour: angular .module('app') .directive('stat24hour', stat24hour); function stat24hour(req) { var directive = { link: link, template: 'scripts/widgets/templ ...

Configuring Firefox settings in Nightwatch

Is there a way to set Firefox preferences in nightwatch? I am trying to achieve the same thing in Java using nightwatch. To set Firefox preferences in nightwatch, you can use the following code snippet: FirefoxProfile profile = new FirefoxProfile(); prof ...

Unlimited header height with automatic vertical overflow for content on the rest of the page

My page has a header with content that can wrap, so it doesn't have a fixed height. I want the rest of the page to be filled by the content container and activate vertical scroll when there is too much content in the container. I've tried various ...