diff --git a/js/auto_submit.js b/js/auto_submit.js
index 36a4c85..2db3d23 100644
--- a/js/auto_submit.js
+++ b/js/auto_submit.js
@@ -41,12 +41,38 @@
    * supported. We probably could use additional support for HTML5 input types.
    */
   Drupal.behaviors.betterExposedFiltersAutoSubmit = {
-    attach: function (context) {
+    attach: function (context, settings) {
       // When exposed as a block, the form #attributes are moved from the form
       // to the block element, thus the second selector.
       // @see \Drupal\block\BlockViewBuilder::preRender
       var selectors = 'form[data-bef-auto-submit-full-form], [data-bef-auto-submit-full-form] form, [data-bef-auto-submit]';

+      $(selectors, context).addBack(selectors).find('input:text:not(.hasDatepicker), textarea').each(function (index, value) {
+        const $el = $(this);
+        var $valueLength = $el.val().length * 2;
+
+        $el[0].setSelectionRange($valueLength, $valueLength);
+
+        setFocus($el, $valueLength);
+      });
+
+      function setFocus($el, $valueLength) {
+        const observer = new IntersectionObserver((entries, observer) => {
+          entries.forEach(entry => {
+            if (entry.isIntersecting) {
+              const $lastTriggeredSelector = $(settings.bef_autosubmit_target).attr('data-drupal-selector');
+              const $isLastTriggered = $lastTriggeredSelector === $el.attr('data-drupal-selector');
+
+              if ($valueLength !== 0 || $isLastTriggered) {
+                $el.focus();
+              }
+            }
+          })
+        })
+
+        observer.observe($el.get(0))
+      }
+
       // The change event bubbles so we only need to bind it to the outer form
       // in case of a full form, or a single element when specified explicitly.
       $(selectors, context).addBack(selectors).each(function (i, e) {
@@ -116,6 +142,8 @@
         else if (e.type === 'change') {
           $submit.click();
         }
+
+        settings.bef_autosubmit_target = $target;
       }
     }
   }
