GithubHelp home page GithubHelp logo

Comments (3)

jcarrera avatar jcarrera commented on May 22, 2024 5

I agree but I ended up implementing something myself. Here's some code that others can use to get something working:

{
    onHover( suggestion, element ){
        // If the hover is via mouse, an element will be present. We are only interested in hovers with keyboard
        // so that we can scroll properly.
        if( !element ){
          // Wait for next tick so that the DOM is updated and the hover class is on the latest element instead
          // of the previous one.
          this.$nextTick(() => {
            const overlayElement = this.getOverlayElement();
            const hoveredElement = this.getHoveredElement();
            this.scrollToElement( hoveredElement, overlayElement );
          });
        }

        this.$emit( 'hover', suggestion, element );
      },
      scrollToElement( element, parentElement ){
        if( parentElement && parentElement.contains( element )){
          const { clientHeight, scrollTop } = parentElement;
          const { offsetHeight, offsetTop } = element;
          
         if( offsetTop < scrollTop ){
            parentElement.scrollTop = offsetTop; // scroll up
          } else {
            const offsetBottom = offsetTop + offsetHeight;
            const scrollBottom = scrollTop + clientHeight;
            if( offsetBottom > scrollBottom ){
              parentElement.scrollTop = offsetBottom - clientHeight; // scroll down
            }
          }
        }
      }
}

@panay

from vue-simple-suggest.

Raiondesu avatar Raiondesu commented on May 22, 2024

Hello, @jcarrera.
Unfortunately, the feature you're talking about does not rest within vue-simple-suggest's responsibilities and can be classified as custom behaviour because there are many varieties of possible behaviours for suggestions scrolling.

Even though the behaviour you request is pretty much standard, we think you could still easily implement this yourself using the controls prop or listening to the hover event.

If I misunderstood your request - please let me know.

from vue-simple-suggest.

panay avatar panay commented on May 22, 2024

Hi, @Raiondesu
I think that it should be included in this plugin? If you change the default browser behavior, then you should make it is work.

from vue-simple-suggest.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.