primefaces / primefaces/primereact

Autocomplete: Ability to position overlay

Open
#7,611 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Type: Enhancement
Dominant language
CSS
Stars
8.3k
Forks
1.2k
PR merge metrics
No merged PRs in 30d

Description

Hi! 👋

Firstly, thanks for your work on this project! 🙂

Today I used patch-package to patch primereact@10.8.4 for the project I'm working on.

Here is the diff that solved my problem:

diff --git a/node_modules/primereact/autocomplete/autocomplete.esm.js b/node_modules/primereact/autocomplete/autocomplete.esm.js
index 7ccf156..9bfd60b 100644
--- a/node_modules/primereact/autocomplete/autocomplete.esm.js
+++ b/node_modules/primereact/autocomplete/autocomplete.esm.js
@@ -728,7 +728,7 @@ var AutoComplete = /*#__PURE__*/React.memo(/*#__PURE__*/React.forwardRef(functio
     props.onHide && props.onHide();
   };
   var alignOverlay = function alignOverlay() {
-    var target = props.multiple ? multiContainerRef.current : inputRef.current;
+    var target = props.overlayTarget || (props.multiple ? multiContainerRef.current : inputRef.current);
     DomHandler.alignOverlay(overlayRef.current, target, props.appendTo || context && context.appendTo || PrimeReact.appendTo);
   };
   var onPanelClick = function onPanelClick(event) {
diff --git a/node_modules/primereact/autocomplete/autocomplete.js b/node_modules/primereact/autocomplete/autocomplete.js
index 2fdd22c..8d7e1d6 100644
--- a/node_modules/primereact/autocomplete/autocomplete.js
+++ b/node_modules/primereact/autocomplete/autocomplete.js
@@ -737,7 +737,7 @@ this.primereact.autocomplete = (function (exports, React, PrimeReact, button, co
       props.onHide && props.onHide();
     };
     var alignOverlay = function alignOverlay() {
-      var target = props.multiple ? multiContainerRef.current : inputRef.current;
+      var target = props.overlayTarget || (props.multiple ? multiContainerRef.current : inputRef.current);
       utils.DomHandler.alignOverlay(overlayRef.current, target, props.appendTo || context && context.appendTo || PrimeReact__default["default"].appendTo);
     };
     var onPanelClick = function onPanelClick(event) {

This issue body was partially generated by patch-package.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the AutoComplete source corresponding to the generated autocomplete.js and autocomplete.esm.js shown in the report. Review how the overlay target is selected, then add coverage for positioning the overlay with the requested target; done means the relevant AutoComplete tests pass.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, react
Domain
frontend
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.