Code Monkey home page Code Monkey logo

Comments (2)

atomiks avatar atomiks commented on May 24, 2024

This is a CSS issue, not related to the library. The fixed overlay element contains the floating element when it's out of view but goes outside its bounds, causing scroll and positioning issues. To fix it, make it a sibling:

  {isOpen && (
        <>
          <FloatingOverlay
            className="Popover-overlay"
          />
          <FloatingFocusManager context={context}>
            <div
              className="Popover"
              ref={refs.setFloating}
              style={floatingStyles}
              aria-labelledby={headingId}
              {...getFloatingProps()}
            >
              <h2 id={headingId}>Review balloon</h2>
              <textarea placeholder="Write your review..." />
              <br />
              <button
                style={{ float: "right" }}
                onClick={() => {
                  console.log("Added review.");
                  setIsOpen(false);
                }}
              >
                Add
              </button>
            </div>
          </FloatingFocusManager>
        </>
      )}

I also found anther issue with the tabbing and focus but not sure if I should create a new issue for it?
If I click outside the application main window (such as the browse link) and then use the tab key to get back in to the application where a floating element is open, the focus is not kept in the floating element, the focus goes to elements in the body.

The focus management uses simple guards, so this can happen; but with regular keyboard usage, focus will not escape. It doesn't happen if you use guards={false}, which is recommended for dialogs in particular.

from floating-ui.

AngelaJR avatar AngelaJR commented on May 24, 2024

May be worth adding into FloatingOverlay the documentation about making it a sibling. I took the sample page and documentation to set up the structure.

Thanks!

from floating-ui.

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.