You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by hn...@apache.org on 2026/02/26 22:28:15 UTC

(myfaces-tobago) branch main updated: fix(suggest): progess-spinner

This is an automated email from the ASF dual-hosted git repository.

hnoeth pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/myfaces-tobago.git


The following commit(s) were added to refs/heads/main by this push:
     new 1b9eb1b93a fix(suggest): progess-spinner
1b9eb1b93a is described below

commit 1b9eb1b93aefc2e6e7ba80af0a6c142b3d8e3ebc
Author: Henning Noeth <hn...@apache.org>
AuthorDate: Tue Feb 10 16:34:27 2026 +0100

    fix(suggest): progess-spinner
    
    * add test page
    * fix position
    * fix also select-one/many-list
    
    Issue: TOBAGO-2472
---
 .../900-test/in/suggest/spinner/Spinner.xhtml      | 50 +++++++++++++
 .../server-side-filtering/spinner/Spinner.xhtml    | 62 ++++++++++++++++
 .../server-side-filtering/spinner/Spinner.xhtml    | 62 ++++++++++++++++
 .../src/test/typescript/selectManyList.test.ts     | 66 +++++++++++++++++
 .../src/test/typescript/selectOneList.test.ts      | 86 ++++++++++++++++++++++
 .../src/test/typescript/suggest.test.ts            | 83 +++++++++++++++++++++
 tobago-theme/src/main/scss/_tobago.scss            | 12 +++
 .../src/main/ts/tobago-select-list-base.ts         | 25 ++-----
 .../src/main/ts/tobago-spinner.ts                  | 69 +++++++++++++++++
 .../src/main/ts/tobago-suggest.ts                  | 34 ++-------
 10 files changed, 505 insertions(+), 44 deletions(-)

diff --git a/tobago-example/tobago-example-demo/src/main/webapp/content/900-test/in/suggest/spinner/Spinner.xhtml b/tobago-example/tobago-example-demo/src/main/webapp/content/900-test/in/suggest/spinner/Spinner.xhtml
new file mode 100644
index 0000000000..40fd2b004c
--- /dev/null
+++ b/tobago-example/tobago-example-demo/src/main/webapp/content/900-test/in/suggest/spinner/Spinner.xhtml
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+-->
+
+<ui:composition template="/main.xhtml"
+                xmlns="http://www.w3.org/1999/xhtml"
+                xmlns:f="jakarta.faces.core"
+                xmlns:tc="http://myfaces.apache.org/tobago/component"
+                xmlns:ui="http://xmlns.jcp.org/jsf/facelets">
+
+  <tc:in id="standardInput">
+    <tc:suggest query="#{suggestController.query}" delay="200000">
+      <tc:selectItems value="#{suggestController.solarObjects}" var="name" itemValue="#{name}"/>
+    </tc:suggest>
+  </tc:in>
+
+  <tc:in id="groupInput">
+    <f:facet name="before">before</f:facet>
+    <f:facet name="after">after</f:facet>
+    <tc:suggest query="#{suggestController.query}" delay="200000">
+      <tc:selectItems value="#{suggestController.solarObjects}" var="name" itemValue="#{name}"/>
+    </tc:suggest>
+  </tc:in>
+
+  <tc:button id="openPopupButton" label="open popup">
+    <tc:operation for="popup" name="show"/>
+  </tc:button>
+  <tc:popup id="popup">
+    <tc:in id="popupInput">
+      <tc:suggest query="#{suggestController.query}" delay="200000">
+        <tc:selectItems value="#{suggestController.solarObjects}" var="name" itemValue="#{name}"/>
+      </tc:suggest>
+    </tc:in>
+  </tc:popup>
+</ui:composition>
diff --git a/tobago-example/tobago-example-demo/src/main/webapp/content/900-test/selectManyList/server-side-filtering/spinner/Spinner.xhtml b/tobago-example/tobago-example-demo/src/main/webapp/content/900-test/selectManyList/server-side-filtering/spinner/Spinner.xhtml
new file mode 100644
index 0000000000..4db689daee
--- /dev/null
+++ b/tobago-example/tobago-example-demo/src/main/webapp/content/900-test/selectManyList/server-side-filtering/spinner/Spinner.xhtml
@@ -0,0 +1,62 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+-->
+
+<ui:composition template="/main.xhtml"
+                xmlns="http://www.w3.org/1999/xhtml"
+                xmlns:f="jakarta.faces.core"
+                xmlns:tc="http://myfaces.apache.org/tobago/component"
+                xmlns:ui="http://xmlns.jcp.org/jsf/facelets">
+
+  <tc:selectManyList id="standardSelectManyList"
+                     value="#{selectListServerFilterController.selectedSolarObjects}"
+                     footer="#{selectListServerFilterController.footerTextMany}">
+    <tc:selectItemsFiltered value="#{selectListServerFilterController.solarObjectsMany}"
+                            var="planet" itemLabel="#{planet.name}" itemValue="#{planet}"
+                            query="#{selectListServerFilterController.queryMany}"
+                            delay="2000000">
+    </tc:selectItemsFiltered>
+  </tc:selectManyList>
+
+  <tc:selectManyList id="groupSelectManyList"
+                     value="#{selectListServerFilterController.selectedSolarObjects}"
+                     footer="#{selectListServerFilterController.footerTextMany}">
+    <f:facet name="before">before</f:facet>
+    <f:facet name="after">after</f:facet>
+    <tc:selectItemsFiltered value="#{selectListServerFilterController.solarObjectsMany}"
+                            var="planet" itemLabel="#{planet.name}" itemValue="#{planet}"
+                            query="#{selectListServerFilterController.queryMany}"
+                            delay="2000000">
+    </tc:selectItemsFiltered>
+  </tc:selectManyList>
+
+  <tc:button id="openPopupButton" label="open popup">
+    <tc:operation for="popup" name="show"/>
+  </tc:button>
+  <tc:popup id="popup">
+    <tc:selectManyList id="popupSelectManyList"
+                       value="#{selectListServerFilterController.selectedSolarObjects}"
+                       footer="#{selectListServerFilterController.footerTextMany}">
+      <tc:selectItemsFiltered value="#{selectListServerFilterController.solarObjectsMany}"
+                              var="planet" itemLabel="#{planet.name}" itemValue="#{planet}"
+                              query="#{selectListServerFilterController.queryMany}"
+                              delay="2000000">
+      </tc:selectItemsFiltered>
+    </tc:selectManyList>
+  </tc:popup>
+</ui:composition>
diff --git a/tobago-example/tobago-example-demo/src/main/webapp/content/900-test/selectOneList/server-side-filtering/spinner/Spinner.xhtml b/tobago-example/tobago-example-demo/src/main/webapp/content/900-test/selectOneList/server-side-filtering/spinner/Spinner.xhtml
new file mode 100644
index 0000000000..cd4bb2478e
--- /dev/null
+++ b/tobago-example/tobago-example-demo/src/main/webapp/content/900-test/selectOneList/server-side-filtering/spinner/Spinner.xhtml
@@ -0,0 +1,62 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+-->
+
+<ui:composition template="/main.xhtml"
+                xmlns="http://www.w3.org/1999/xhtml"
+                xmlns:f="jakarta.faces.core"
+                xmlns:tc="http://myfaces.apache.org/tobago/component"
+                xmlns:ui="http://xmlns.jcp.org/jsf/facelets">
+
+  <tc:selectOneList id="standardSelectOneList"
+                     value="#{selectListServerFilterController.selectedSolarObjects}"
+                     footer="#{selectListServerFilterController.footerTextMany}">
+    <tc:selectItemsFiltered value="#{selectListServerFilterController.solarObjectsMany}"
+                            var="planet" itemLabel="#{planet.name}" itemValue="#{planet}"
+                            query="#{selectListServerFilterController.queryMany}"
+                            delay="2000000">
+    </tc:selectItemsFiltered>
+  </tc:selectOneList>
+
+  <tc:selectOneList id="groupSelectOneList"
+                     value="#{selectListServerFilterController.selectedSolarObjects}"
+                     footer="#{selectListServerFilterController.footerTextMany}">
+    <f:facet name="before">before</f:facet>
+    <f:facet name="after">after</f:facet>
+    <tc:selectItemsFiltered value="#{selectListServerFilterController.solarObjectsMany}"
+                            var="planet" itemLabel="#{planet.name}" itemValue="#{planet}"
+                            query="#{selectListServerFilterController.queryMany}"
+                            delay="2000000">
+    </tc:selectItemsFiltered>
+  </tc:selectOneList>
+
+  <tc:button id="openPopupButton" label="open popup">
+    <tc:operation for="popup" name="show"/>
+  </tc:button>
+  <tc:popup id="popup">
+    <tc:selectOneList id="popupSelectOneList"
+                       value="#{selectListServerFilterController.selectedSolarObjects}"
+                       footer="#{selectListServerFilterController.footerTextMany}">
+      <tc:selectItemsFiltered value="#{selectListServerFilterController.solarObjectsMany}"
+                              var="planet" itemLabel="#{planet.name}" itemValue="#{planet}"
+                              query="#{selectListServerFilterController.queryMany}"
+                              delay="2000000">
+      </tc:selectItemsFiltered>
+    </tc:selectOneList>
+  </tc:popup>
+</ui:composition>
diff --git a/tobago-example/tobago-example-demo/src/test/typescript/selectManyList.test.ts b/tobago-example/tobago-example-demo/src/test/typescript/selectManyList.test.ts
index c8d66747ff..c25f5dfad8 100644
--- a/tobago-example/tobago-example-demo/src/test/typescript/selectManyList.test.ts
+++ b/tobago-example/tobago-example-demo/src/test/typescript/selectManyList.test.ts
@@ -48,3 +48,69 @@ test.describe("900-test/2100-selectManyList/deselect/deselect.xhtml", () => {
     await expect(jupiter).not.toBeVisible();
   });
 });
+
+test.describe("900-test/selectManyList/server-side-filtering/spinner/Spinner.xhtml", () => {
+
+  test.beforeEach(async ({page}, testInfo) => {
+    await page.goto("/content/900-test/selectManyList/server-side-filtering/spinner/Spinner.xhtml");
+  });
+
+  test("Spinner position: standard", async ({page}) => {
+    const input = page.locator("tobago-select-many-list[id='page:mainForm:standardSelectManyList']");
+    const field = input.locator(".tobago-select-field");
+    const filter = input.locator("input[id='page:mainForm:standardSelectManyList::filter']");
+    const spinner = input.locator(".spinner");
+
+    await filter.fill("show spinner");
+    await expect(filter).toBeVisible();
+
+    const fieldBox = await field.boundingBox();
+    const spinnerBox = await spinner.boundingBox();
+    expect(fieldBox.x).toBeLessThanOrEqual(spinnerBox.x);
+    expect(fieldBox.x + fieldBox.width).toBeGreaterThanOrEqual(spinnerBox.x + spinnerBox.width);
+    expect(fieldBox.y).toBeLessThanOrEqual(spinnerBox.y);
+    expect(fieldBox.y + fieldBox.height).toBeGreaterThanOrEqual(spinnerBox.y + spinnerBox.height);
+  });
+
+  test("Spinner position: input group", async ({page}) => {
+    const input = page.locator("tobago-select-many-list[id='page:mainForm:groupSelectManyList']");
+    const field = input.locator(".tobago-select-field");
+    const filter = input.locator("input[id='page:mainForm:groupSelectManyList::filter']");
+    const spinner = input.locator(".spinner");
+
+    await filter.fill("show spinner");
+    await expect(filter).toBeVisible();
+
+    const fieldBox = await field.boundingBox();
+    const spinnerBox = await spinner.boundingBox();
+    expect(fieldBox.x).toBeLessThanOrEqual(spinnerBox.x);
+    expect(fieldBox.x + fieldBox.width).toBeGreaterThanOrEqual(spinnerBox.x + spinnerBox.width);
+    expect(fieldBox.y).toBeLessThanOrEqual(spinnerBox.y);
+    expect(fieldBox.y + fieldBox.height).toBeGreaterThanOrEqual(spinnerBox.y + spinnerBox.height);
+  });
+
+  test("Spinner position: popup", async ({page}) => {
+    const button = page.locator("button[id='page:mainForm:openPopupButton']");
+    const popup = page.locator("[id='page:mainForm:popup']");
+    const collapse = page.locator("input[id='page:mainForm:popup::collapse']");
+    const input = page.locator("tobago-select-many-list[id='page:mainForm:popup:popupSelectManyList']");
+    const field = input.locator(".tobago-select-field");
+    const filter = input.locator("input[id='page:mainForm:popup:popupSelectManyList::filter']");
+    const spinner = input.locator(".spinner");
+
+    await button.click();
+    await expect(popup).toContainClass("show");
+    await expect(collapse).toHaveValue("false");
+    await expect(field).toBeVisible();
+
+    await filter.fill("show spinner");
+    await expect(spinner).toBeVisible();
+
+    const fieldBox = await field.boundingBox();
+    const spinnerBox = await spinner.boundingBox();
+    expect(fieldBox.x).toBeLessThanOrEqual(spinnerBox.x);
+    expect(fieldBox.x + fieldBox.width).toBeGreaterThanOrEqual(spinnerBox.x + spinnerBox.width);
+    expect(fieldBox.y).toBeLessThanOrEqual(spinnerBox.y);
+    expect(fieldBox.y + fieldBox.height).toBeGreaterThanOrEqual(spinnerBox.y + spinnerBox.height);
+  });
+});
diff --git a/tobago-example/tobago-example-demo/src/test/typescript/selectOneList.test.ts b/tobago-example/tobago-example-demo/src/test/typescript/selectOneList.test.ts
new file mode 100644
index 0000000000..5c617a5a1d
--- /dev/null
+++ b/tobago-example/tobago-example-demo/src/test/typescript/selectOneList.test.ts
@@ -0,0 +1,86 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import {expect, test} from "@playwright/test";
+
+test.describe("900-test/selectOneList/server-side-filtering/spinner/Spinner.xhtml", () => {
+
+  test.beforeEach(async ({page}, testInfo) => {
+    await page.goto("/content/900-test/selectOneList/server-side-filtering/spinner/Spinner.xhtml");
+  });
+
+  test("Spinner position: standard", async ({page}) => {
+    const input = page.locator("tobago-select-one-list[id='page:mainForm:standardSelectOneList']");
+    const field = input.locator(".tobago-select-field");
+    const filter = input.locator("input[id='page:mainForm:standardSelectOneList::filter']");
+    const spinner = input.locator(".spinner");
+
+    await filter.fill("show spinner");
+    await expect(filter).toBeVisible();
+
+    const fieldBox = await field.boundingBox();
+    const spinnerBox = await spinner.boundingBox();
+    expect(fieldBox.x).toBeLessThanOrEqual(spinnerBox.x);
+    expect(fieldBox.x + fieldBox.width).toBeGreaterThanOrEqual(spinnerBox.x + spinnerBox.width);
+    expect(fieldBox.y).toBeLessThanOrEqual(spinnerBox.y);
+    expect(fieldBox.y + fieldBox.height).toBeGreaterThanOrEqual(spinnerBox.y + spinnerBox.height);
+  });
+
+  test("Spinner position: input group", async ({page}) => {
+    const input = page.locator("tobago-select-one-list[id='page:mainForm:groupSelectOneList']");
+    const field = input.locator(".tobago-select-field");
+    const filter = input.locator("input[id='page:mainForm:groupSelectOneList::filter']");
+    const spinner = input.locator(".spinner");
+
+    await filter.fill("show spinner");
+    await expect(filter).toBeVisible();
+
+    const fieldBox = await field.boundingBox();
+    const spinnerBox = await spinner.boundingBox();
+    expect(fieldBox.x).toBeLessThanOrEqual(spinnerBox.x);
+    expect(fieldBox.x + fieldBox.width).toBeGreaterThanOrEqual(spinnerBox.x + spinnerBox.width);
+    expect(fieldBox.y).toBeLessThanOrEqual(spinnerBox.y);
+    expect(fieldBox.y + fieldBox.height).toBeGreaterThanOrEqual(spinnerBox.y + spinnerBox.height);
+  });
+
+  test("Spinner position: popup", async ({page}) => {
+    const button = page.locator("button[id='page:mainForm:openPopupButton']");
+    const popup = page.locator("[id='page:mainForm:popup']");
+    const collapse = page.locator("input[id='page:mainForm:popup::collapse']");
+    const input = page.locator("tobago-select-one-list[id='page:mainForm:popup:popupSelectOneList']");
+    const field = input.locator(".tobago-select-field");
+    const filter = input.locator("input[id='page:mainForm:popup:popupSelectOneList::filter']");
+    const spinner = input.locator(".spinner");
+
+    await button.click();
+    await expect(popup).toContainClass("show");
+    await expect(collapse).toHaveValue("false");
+    await expect(field).toBeVisible();
+
+    await filter.fill("show spinner");
+    await expect(spinner).toBeVisible();
+
+    const fieldBox = await field.boundingBox();
+    const spinnerBox = await spinner.boundingBox();
+    expect(fieldBox.x).toBeLessThanOrEqual(spinnerBox.x);
+    expect(fieldBox.x + fieldBox.width).toBeGreaterThanOrEqual(spinnerBox.x + spinnerBox.width);
+    expect(fieldBox.y).toBeLessThanOrEqual(spinnerBox.y);
+    expect(fieldBox.y + fieldBox.height).toBeGreaterThanOrEqual(spinnerBox.y + spinnerBox.height);
+  });
+});
diff --git a/tobago-example/tobago-example-demo/src/test/typescript/suggest.test.ts b/tobago-example/tobago-example-demo/src/test/typescript/suggest.test.ts
new file mode 100644
index 0000000000..d0e0b4e588
--- /dev/null
+++ b/tobago-example/tobago-example-demo/src/test/typescript/suggest.test.ts
@@ -0,0 +1,83 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import {expect, test} from "@playwright/test";
+
+test.describe("900-test/in/suggest/spinner/Spinner.xhtml", () => {
+
+  test.beforeEach(async ({page}, testInfo) => {
+    await page.goto("/content/900-test/in/suggest/spinner/Spinner.xhtml");
+  });
+
+  test("Spinner position: standard", async ({page}) => {
+    const input = page.locator("tobago-in[id='page:mainForm:standardInput']");
+    const field = input.locator("input[type='text']");
+    const spinner = input.locator(".spinner");
+
+    await field.fill("show spinner");
+    await expect(spinner).toBeVisible();
+
+    const fieldBox = await field.boundingBox();
+    const spinnerBox = await spinner.boundingBox();
+    expect(fieldBox.x).toBeLessThanOrEqual(spinnerBox.x);
+    expect(fieldBox.x + fieldBox.width).toBeGreaterThanOrEqual(spinnerBox.x + spinnerBox.width);
+    expect(fieldBox.y).toBeLessThanOrEqual(spinnerBox.y);
+    expect(fieldBox.y + fieldBox.height).toBeGreaterThanOrEqual(spinnerBox.y + spinnerBox.height);
+  });
+
+  test("Spinner position: input group", async ({page}) => {
+    const input = page.locator("tobago-in[id='page:mainForm:groupInput']");
+    const field = input.locator("input[type='text']");
+    const spinner = input.locator(".spinner");
+
+    await field.fill("show spinner");
+    await expect(spinner).toBeVisible();
+
+    const fieldBox = await field.boundingBox();
+    const spinnerBox = await spinner.boundingBox();
+    expect(fieldBox.x).toBeLessThanOrEqual(spinnerBox.x);
+    expect(fieldBox.x + fieldBox.width).toBeGreaterThanOrEqual(spinnerBox.x + spinnerBox.width);
+    expect(fieldBox.y).toBeLessThanOrEqual(spinnerBox.y);
+    expect(fieldBox.y + fieldBox.height).toBeGreaterThanOrEqual(spinnerBox.y + spinnerBox.height);
+  });
+
+  test("Spinner position: popup", async ({page}) => {
+    const button = page.locator("button[id='page:mainForm:openPopupButton']");
+    const popup = page.locator("[id='page:mainForm:popup']");
+    const collapse = page.locator("input[id='page:mainForm:popup::collapse']");
+    const input = page.locator("tobago-in[id='page:mainForm:popup:popupInput']");
+    const field = input.locator("input[type='text']");
+    const spinner = input.locator(".spinner");
+
+    await button.click();
+    await expect(popup).toContainClass("show");
+    await expect(collapse).toHaveValue("false");
+    await expect(field).toBeVisible();
+
+    await field.fill("show spinner");
+    await expect(spinner).toBeVisible();
+
+    const fieldBox = await field.boundingBox();
+    const spinnerBox = await spinner.boundingBox();
+    expect(fieldBox.x).toBeLessThanOrEqual(spinnerBox.x);
+    expect(fieldBox.x + fieldBox.width).toBeGreaterThanOrEqual(spinnerBox.x + spinnerBox.width);
+    expect(fieldBox.y).toBeLessThanOrEqual(spinnerBox.y);
+    expect(fieldBox.y + fieldBox.height).toBeGreaterThanOrEqual(spinnerBox.y + spinnerBox.height);
+  });
+});
diff --git a/tobago-theme/src/main/scss/_tobago.scss b/tobago-theme/src/main/scss/_tobago.scss
index 56ad29bfad..b9ee2f7080 100644
--- a/tobago-theme/src/main/scss/_tobago.scss
+++ b/tobago-theme/src/main/scss/_tobago.scss
@@ -392,6 +392,8 @@ @mixin spinner() {
   .spinner {
     display: none;
     position: absolute;
+    top: 50%;
+    transform: translateY(-50%);
 
     &.tobago-show {
       display: block;
@@ -823,11 +825,17 @@ tobago-image {
 
 tobago-in {
   display: block;
+  position: relative;
+  //anchor-scope: all;
 
   &.tobago-readonly {
     //added because of TobagoClassUnitTest
   }
 
+  input.form-control {
+    //anchor-name: --tobago-in-field;
+  }
+
   .input-group {
     > tobago-dropdown {
       /* fix corner styling, because tobago-dropdown use a surrounding container inside an input group */
@@ -1510,6 +1518,8 @@ tobago-select-one-list {
   @include selectListOptions();
   @include spinner();
 
+  position: relative;
+
   .tobago-select-field {
     span {
       white-space: nowrap;
@@ -1542,6 +1552,8 @@ tobago-select-many-list {
   @include selectListOptions();
   @include spinner();
 
+  position: relative;
+
   &.tobago-focus[filter] .tobago-select-field {
     flex-wrap: wrap;
   }
diff --git a/tobago-theme/tobago-theme-standard/src/main/ts/tobago-select-list-base.ts b/tobago-theme/tobago-theme-standard/src/main/ts/tobago-select-list-base.ts
index a95bcac146..b67a6dc21d 100644
--- a/tobago-theme/tobago-theme-standard/src/main/ts/tobago-select-list-base.ts
+++ b/tobago-theme/tobago-theme-standard/src/main/ts/tobago-select-list-base.ts
@@ -19,12 +19,14 @@ import {Css} from "./tobago-css";
 import {TobagoFilterRegistry} from "./tobago-filter-registry";
 import {Key} from "./tobago-key";
 import {DropdownMenu, DropdownMenuAlignment} from "./tobago-dropdown-menu";
+import {Spinner} from "./tobago-spinner";
 
 export abstract class SelectListBase extends HTMLElement {
 
   private static readonly SUFFIX_FILTER_UPDATE: string = "::filter-update";
 
   protected dropdownMenu: DropdownMenu;
+  private spinner: Spinner;
   private timeout: number;
   private filterUpdateLoader: HTMLElement;
   protected lastSuccessfulSearchQuery: string;
@@ -46,6 +48,7 @@ export abstract class SelectListBase extends HTMLElement {
     }
     if (this.serverSideFiltering) {
       this.insertAdjacentHTML("beforeend", `<div class="${Css.SPINNER}"/>`);
+      this.spinner = new Spinner(this, this.selectField, this.filterInput, this.spinnerDiv);
     }
     this.tbody.addEventListener("click", this.tbodyClickEvent.bind(this));
 
@@ -248,26 +251,12 @@ Type: ${data.type}`);
   }
 
   private showSpinner(): void {
-    const rect = this.selectField.getBoundingClientRect();
-    const cStyle = getComputedStyle(this.selectField);
-    const top = window.scrollY + rect.top;
-    const right = window.scrollX + rect.right;
-    const bottom = window.scrollY + rect.bottom;
-    const innerBorderTop = top + parseFloat(cStyle.borderTopWidth) + parseFloat(cStyle.paddingTop);
-    const innerBorderRight = right - parseFloat(cStyle.borderRight) - parseFloat(cStyle.paddingRight);
-    const innerBorderBottom = bottom - parseFloat(cStyle.borderBottom) - parseFloat(cStyle.paddingBottom);
-    const size = innerBorderBottom - innerBorderTop;
-    this.spinner.style.width = size + "px";
-    this.spinner.style.height = size + "px";
-    this.spinner.style.top = innerBorderTop + "px";
-    this.spinner.style.left = (innerBorderRight - size) + "px";
-    this.spinner.classList.add(Css.TOBAGO_SHOW);
-
-    this.filterInput.style.marginRight = size + "px";
+    this.filterInput.style.marginRight = this.spinner.size + "px";
+    this.spinner.show();
   }
 
   private hideSpinner(): void {
-    this.spinner.classList.remove(Css.TOBAGO_SHOW);
+    this.spinner.hide();
     this.filterInput.style.marginRight = null;
   }
 
@@ -458,7 +447,7 @@ Type: ${data.type}`);
     return minChars ? parseInt(minChars) : 0;
   }
 
-  private get spinner(): HTMLDivElement {
+  private get spinnerDiv(): HTMLDivElement {
     return this.querySelector<HTMLDivElement>(`.${Css.SPINNER}`);
   }
 }
diff --git a/tobago-theme/tobago-theme-standard/src/main/ts/tobago-spinner.ts b/tobago-theme/tobago-theme-standard/src/main/ts/tobago-spinner.ts
new file mode 100644
index 0000000000..ebefcb0623
--- /dev/null
+++ b/tobago-theme/tobago-theme-standard/src/main/ts/tobago-spinner.ts
@@ -0,0 +1,69 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import {Css} from "./tobago-css";
+
+export class Spinner {
+  private base: HTMLElement;
+  private referenceElement: HTMLElement;
+  private inputField: HTMLElement;
+  private spinner: HTMLElement;
+
+  /**
+   * Constructs an instance of the class with required DOM elements.
+   *
+   * @param {HTMLElement} baseElement root element for the component
+   * @param {HTMLElement} referenceElement for positioning
+   * @param {HTMLElement} inputField to measure the height
+   * @param {HTMLElement} spinner DIV element which contains the spinner
+   */
+  constructor(baseElement: HTMLElement, referenceElement: HTMLElement, inputField: HTMLElement, spinner: HTMLElement) {
+    this.base = baseElement;
+    this.referenceElement = referenceElement;
+    this.inputField = inputField;
+    this.spinner = spinner;
+  }
+
+  public show(): void {
+    this.spinner.style.right = (this.right + this.marginRight) + "px";
+    this.spinner.style.width = this.size + "px";
+    this.spinner.style.height = this.size + "px";
+    this.spinner.classList.add(Css.TOBAGO_SHOW);
+  }
+
+  public hide(): void {
+    this.spinner.classList.remove(Css.TOBAGO_SHOW);
+  }
+
+  public get size(): number {
+    const cStyle = getComputedStyle(this.inputField);
+    return this.inputField.clientHeight - parseFloat(cStyle.paddingTop) - parseFloat(cStyle.paddingBottom);
+  }
+
+  private get marginRight(): number {
+    const cStyle = getComputedStyle(this.referenceElement);
+    return parseFloat(cStyle.borderWidth) + parseFloat(cStyle.paddingRight);
+  }
+
+  private get right(): number {
+    const baseBox = this.base.getBoundingClientRect();
+    const refBox = this.referenceElement.getBoundingClientRect();
+    return baseBox.right - refBox.right;
+  }
+}
diff --git a/tobago-theme/tobago-theme-standard/src/main/ts/tobago-suggest.ts b/tobago-theme/tobago-theme-standard/src/main/ts/tobago-suggest.ts
index e682f4b961..931a4d595a 100644
--- a/tobago-theme/tobago-theme-standard/src/main/ts/tobago-suggest.ts
+++ b/tobago-theme/tobago-theme-standard/src/main/ts/tobago-suggest.ts
@@ -20,10 +20,12 @@ import {Css} from "./tobago-css";
 import {DropdownMenu, DropdownMenuAlignment} from "./tobago-dropdown-menu";
 import {Key} from "./tobago-key";
 import {ClientBehaviors} from "./tobago-client-behaviors";
+import {Spinner} from "./tobago-spinner";
 
 export class Suggest {
   private tobagoIn: HTMLElement;
   private dropdownMenu: DropdownMenu;
+  private spinner: Spinner;
   private timeout: number;
 
   constructor(tobagoIn: HTMLElement) {
@@ -36,10 +38,11 @@ export class Suggest {
       return;
     }
     this.tobagoSuggest.insertAdjacentHTML("beforebegin", `<div class="${Css.SPINNER}"/>`);
+    this.spinner = new Spinner(this.tobagoIn, this.inputField, this.inputField, this.spinnerDiv);
+
     this.tobagoSuggest.insertAdjacentHTML("beforebegin", `<div class="${Css.TOBAGO_DROPDOWN_MENU_ANCHOR}"}">
     <ul id="${this.tobagoSuggest.id + "::dropdownMenu"}" class="${Css.TOBAGO_DROPDOWN_MENU}"
     name="${this.tobagoSuggest.id}" role="listbox"/></div>`);
-
     this.dropdownMenu = new DropdownMenu(this.dropdownMenuElement, this.inputField, this.tobagoIn, this.localMenu,
         DropdownMenuAlignment.centerFullWidth);
 
@@ -161,7 +164,7 @@ export class Suggest {
 
     if (input.length >= this.minChars) {
       this.hiddenInput.value = input.toLowerCase();
-      this.showSpinner();
+      this.spinner.show();
 
       if (this.update) {
         this.timeout = window.setTimeout(() => {
@@ -194,27 +197,6 @@ export class Suggest {
     }
   }
 
-  private showSpinner(): void {
-    const rect = this.inputField.getBoundingClientRect();
-    const cStyle = getComputedStyle(this.inputField);
-    const top = window.scrollY + rect.top;
-    const right = window.scrollX + rect.right;
-    const bottom = window.scrollY + rect.bottom;
-    const innerBorderTop = top + parseFloat(cStyle.borderTopWidth) + parseFloat(cStyle.paddingTop);
-    const innerBorderRight = right - parseFloat(cStyle.borderRight) - parseFloat(cStyle.paddingRight);
-    const innerBorderBottom = bottom - parseFloat(cStyle.borderBottom) - parseFloat(cStyle.paddingBottom);
-    const size = innerBorderBottom - innerBorderTop;
-    this.spinner.style.width = size + "px";
-    this.spinner.style.height = size + "px";
-    this.spinner.style.top = innerBorderTop + "px";
-    this.spinner.style.left = (innerBorderRight - size) + "px";
-    this.spinner.classList.add(Css.TOBAGO_SHOW);
-  }
-
-  private hideSpinner(): void {
-    this.spinner.classList.remove(Css.TOBAGO_SHOW);
-  }
-
   private ajaxEvent(event: EventData): void {
     if (event.status === "success") {
       this.renderResults(this.items);
@@ -237,7 +219,7 @@ export class Suggest {
         dropdownItems.push(li);
       }
       this.dropdownMenuElement.replaceChildren(...dropdownItems);
-      this.hideSpinner();
+      this.spinner.hide();
       this.dropdownMenu.show();
 
       if (this.maxItems > 0) {
@@ -254,7 +236,7 @@ export class Suggest {
         }
       }
     } else {
-      this.hideSpinner();
+      this.spinner.hide();
       this.dropdownMenu.hide();
     }
   }
@@ -280,7 +262,7 @@ export class Suggest {
     return root.getElementById(this.tobagoSuggest.getAttribute("for")) as HTMLInputElement;
   }
 
-  private get spinner(): HTMLDivElement {
+  private get spinnerDiv(): HTMLDivElement {
     return this.tobagoIn.querySelector<HTMLDivElement>(`.${Css.SPINNER}`);
   }