Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Focus automatically moves to the first input field when the Shepherd tooltip is displayed inside the Quasar dialog

未关闭
#3,505 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 3 天内回复

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
52/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
活跃
技术栈
javascript
领域
frontend

调研方向

从提供的 Shepherd.Tour 复现和 Quasar 对话框标记开始,然后跟踪负责在对话框打开后移动焦点的 tooltip 和焦点处理入口点。使用地址输入框复现该问题,并确认焦点仍停留在 pincode 输入框上,而不是移动到第一个输入框。

由索引模型根据 Issue 内容生成。

描述

https://github.com/user-attachments/assets/277c233b-3522-4d75-8481-42fa2b48115f

 const tour = new Shepherd.Tour({
    defaultStepOptions: {
      scrollTo: false,
      showCancelLink: true
    }
  });
  tour.addStep({
    id: 'test-button',
    text: 'Click this button to open the address dialog.',
    attachTo: {
      element: '[data-cy="test-button"]',
      on: 'bottom'
    },
    buttons: [
      {
        text: 'Skip',
        action: () => tour.cancel(),
        classes: 'shepherd-button-skip'
      },
      {
        text: 'Next',
        action: () => {
          document
            .querySelector('[data-cy="test-button"]')
            ?.click();

          setTimeout(() => {
            tour.next();
          }, 200);
        }
      }
    ]
  });

  tour.addStep({
    id: 'address-input',
    text: 'Enter your address here.',
    attachTo: {
      element: '[data-cy="address-input"]',
      on: 'bottom'
    },

    beforeShowPromise: () => {
      return new Promise((resolve) => {
        const checkInput = setInterval(() => {
          const input = document.querySelector(
            '[data-cy="address-input"]'
          );

          if (input) {
            clearInterval(checkInput);
            resolve();
          }
        }, 100);
      });
    },

    buttons: [
      {
        text: 'Back',
        action: () => tour.back()
      },
      {
        text: 'Next',
        action: () => tour.next()
      }
    ]
  });

  tour.addStep({
    id: 'address2-input',
    text: 'Enter your address222 here.',
    attachTo: {
      element: '[data-cy="address2-input"]',
      on: 'bottom'
    },

    beforeShowPromise: () => {
      return new Promise((resolve) => {
        const checkInput = setInterval(() => {
          const input = document.querySelector(
            '[data-cy="address2-input"]'
          );

          if (input) {
            clearInterval(checkInput);
            resolve();
          }
        }, 100);
      });
    },

    buttons: [
      {
        text: 'Back',
        action: () => tour.back()
      },
      {
        text: 'Next',
        action: () => tour.next()
      }
    ]
  });

  tour.addStep({
    id: 'pincode-input',
    text: 'Enter your pincode here.',
    attachTo: { element: '[data-cy="pincode-input"]', on: 'bottom' },
    beforeShowPromise: () => {
      return new Promise((resolve) => {
        const checkInput = setInterval(() => {
          const input = document.querySelector('[data-cy="pincode-input"]');
          if (input) {
            input.focus();
            clearInterval(checkInput);
            resolve();
          }
        }, 100);
      });
    },
    buttons: [
      {
        text: 'Back',
        action: () => tour.back()
      },
      {
        text: 'Next',
        action: () => tour.next()
      }
    ]
  });

Quasar dialog code:

<q-dialog v-model="prompt" no-focus
            persistent>
    <q-card data-cy="address-dialog"
            style="min-width: 350px">
      <q-card-section>
        <div class="text-h6">Your address</div>
      </q-card-section>

      <q-card-section class="q-pt-none">
        <q-input data-cy="address-input"
                 dense
                 v-model="address" />
        <q-input data-cy="address2-input"
                 dense
                 v-model="address2" />
        <q-input data-cy="pincode-input"
                 dense
                 v-model="pincode" />
      </q-card-section>

      <q-card-actions align="right" class="text-primary">
        <q-btn data-cy="address-cancel"
               flat
               label="Cancel"
               v-close-popup />

        <q-btn data-cy="address-add"
               flat
               label="Add address"
               v-close-popup />
      </q-card-actions>
    </q-card>
  </q-dialog>

The Pincode input is initially focused when the Shepherd tooltip is displayed, but the focus is then automatically moved to the first input field.

主要语言
JavaScript
星标
13.8k
派生
656
平均合并
2 天 6 小时
30 天内合并 PR
17

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

shipshapecode/shepherd 的其他 Issue

查看 shipshapecode/shepherd 的全部 Issue

相似的 Issue

更多 JavaScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。