core icon indicating copy to clipboard operation
core copied to clipboard

feat: add support for Popover API

Open chirokas opened this issue 9 months ago • 6 comments

Alternate to #10977

Note true and false are invalid values for popover.

Reference https://html.spec.whatwg.org/multipage/popover.html#the-popover-attribute https://github.com/chromium/chromium/blob/196f490f4fa71a9c012a49382da88531b9c1f4cd/third_party/blink/renderer/core/html/html_element.cc#L1214 https://github.com/WebKit/WebKit/blob/bd98799b60c4650552667337e1fcf0728bccc783/Source/WebCore/html/HTMLElement.cpp#L1318

chirokas avatar Mar 28 '25 13:03 chirokas

Size Report

Bundles

File Size Gzip Brotli
runtime-dom.global.prod.js 100 kB 38.1 kB 34.3 kB
vue.global.prod.js 158 kB 58.2 kB 51.9 kB

Usages

Name Size Gzip Brotli
createApp (CAPI only) 46.4 kB 18.1 kB 16.6 kB
createApp 54.4 kB 21.2 kB 19.4 kB
createSSRApp 58.6 kB 22.9 kB 20.9 kB
defineCustomElement 59.2 kB 22.7 kB 20.7 kB
overall 68.4 kB 26.3 kB 24 kB

github-actions[bot] avatar Mar 28 '25 13:03 github-actions[bot]

Open in Stackblitz

@vue/compiler-core

npm i https://pkg.pr.new/@vue/compiler-core@13113
@vue/compiler-dom

npm i https://pkg.pr.new/@vue/compiler-dom@13113
@vue/compiler-sfc

npm i https://pkg.pr.new/@vue/compiler-sfc@13113
@vue/compiler-ssr

npm i https://pkg.pr.new/@vue/compiler-ssr@13113
@vue/reactivity

npm i https://pkg.pr.new/@vue/reactivity@13113
@vue/runtime-core

npm i https://pkg.pr.new/@vue/runtime-core@13113
@vue/runtime-dom

npm i https://pkg.pr.new/@vue/runtime-dom@13113
@vue/server-renderer

npm i https://pkg.pr.new/@vue/server-renderer@13113
@vue/shared

npm i https://pkg.pr.new/@vue/shared@13113
vue

npm i https://pkg.pr.new/vue@13113
@vue/compat

npm i https://pkg.pr.new/@vue/compat@13113

commit: e38cff1

pkg-pr-new[bot] avatar Mar 28 '25 13:03 pkg-pr-new[bot]

Thank you for your contribution. Maybe we should review https://github.com/vuejs/core/pull/10977 first. If the author is no longer active, we can consider creating a new PR.

edison1105 avatar Mar 31 '25 00:03 edison1105

is there any work around for using popover when using jsx syntax. currently its impossible to use popover with error Found a 'popover' attribute with an invalid value.

XpamAmAdEuS avatar Oct 07 '25 15:10 XpamAmAdEuS

I would also like to use this :)

Maybe the jsx.d.ts should be reconsidered long-term to borrow from TypeScript's lib.dom.d.ts, but I imagine that would be... non-trivlal.

connorshea avatar Oct 11 '25 06:10 connorshea

In the mean time, adding a html-attributes.d.ts file like this to my repo seems to work:

// Extend Vue's HTML attributes to include modern HTML attributes that TypeScript doesn't recognize yet

// TODO: Get rid of this file when Vue 3 includes popover attributes in its types.
// https://github.com/vuejs/core/pull/13113

declare module '@vue/runtime-dom' {
  interface HTMLAttributes {
    // Popover API attributes
    popover?: 'auto' | 'manual' | 'hint';
    popovertarget?: string;
    popovertargetaction?: 'show' | 'hide' | 'toggle';
  }
}

// For Vue 2.7 compatibility
declare module 'vue' {
  interface HTMLAttributes {
    // Popover API attributes
    popover?: 'auto' | 'manual' | 'hint';
    popovertarget?: string;
    popovertargetaction?: 'show' | 'hide' | 'toggle';
  }
}

export {};

connorshea avatar Oct 11 '25 07:10 connorshea