Skip to content

Conversation

dupasj
Copy link

@dupasj dupasj commented Jan 26, 2025

Summary

This pull request introduces a new anchor option to the date picker component, allowing better positioning control when the popup might overflow the user's screen.

Changes Introduced

Added an anchor prop with the following options:

  • "left": Anchors the date picker popup to the left of the input element.
  • "right": Anchors the date picker popup to the right of the input element.
  • "auto" (default): Automatically adjusts the position to prevent overflow. The date picker popup will first anchor to the left of the input element. Note: There might be a slight "flash" when the component first appears outside the screen due to the delay of the useEffect hook.

Why This Change?

Previously, the date picker could overflow the viewport if the input element was near the right edge of the screen. This enhancement improves the user experience by ensuring the popup remains fully visible within the viewport.

Potential Improvements

Future enhancements could include:

  • Adding an offset option to allow better spacing adjustments.
  • Using CSS translations instead of repositioning to avoid layout shifts and improve visual appearance.

Documentation

Updated the README to include details about the new anchor option.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant