Can role=”combobox” be used with a non-popup (permanent) list?

I have a dialog box that contains a search box and a list underneath. As you type, the list items are filtered out. Can I add role="combobox" to the input?

With an input combobox, normally, the listbox will dynamically pop up as you type. From the docs: “A combobox is an input widget that has an associated popup”. However, in this UI, the listbox is not a popup, and importantly it’s always visible.

Is this a valid use of ARIA attributes?

<input
  type="search"
  aria-controls="my-list"
  role="combobox"
  aria-autocomplete="list"
  aria-expanded="true" <!-- this feels wrong because it's always true -->
  aria-activedescendant=""
/>
<ul id="my-list" role="listbox" aria-label="Fruits">
  <li role="option">Apple</li>
  <li role="option">Banana</li>
  ...
</ul>

How to set the primary colour of a theme in Primevue template before/on app load

I am using Primevue’s Sakai template https://github.com/primefaces/sakai-vue and would like to set what the primary colour of the Aura theme should be before the app is loaded, for example using a value store in a cookie.

I can do this AFTER the app is loaded by leveraging updateColors in https://github.com/primefaces/sakai-vue/blob/master/src/layout/AppConfigurator.vue, but I would rather set those values before the app is loaded. I believe the code should go in https://github.com/primefaces/sakai-vue/blob/master/src/main.js

import { createApp } from 'vue';
import App from './App.vue';
import router from './router';

import Aura from '@primeuix/themes/aura';
import PrimeVue from 'primevue/config';
import ConfirmationService from 'primevue/confirmationservice';
import ToastService from 'primevue/toastservice';

import '@/assets/styles.scss';

const app = createApp(App);

app.use(router);
app.use(PrimeVue, {
    theme: {
        preset: Aura,
        options: {
            darkModeSelector: '.app-dark'
        }
    }
});
app.use(ToastService);
app.use(ConfirmationService);

app.mount('#app');

As a simple test, I have tried to add the following present, that I got from https://github.com/primefaces/sakai-vue/blob/master/src/layout/AppConfigurator.vue

const myPreset = {
  semantic: {
    primary: {
      50: "#fff1f2",
      100: "#ffe4e6",
      200: "#fecdd3",
      300: "#fda4af",
      400: "#fb7185",
      500: "#f43f5e",
      600: "#e11d48",
      700: "#be123c",
      800: "#9f1239",
      900: "#881337",
      950: "#4c0519"
    },
    colorScheme: {
      light: {
        primary: {
          color: "{primary.500}",
          contrastColor: "#ffffff",
          hoverColor: "{primary.600}",
          activeColor: "{primary.700}"
        },
        highlight: {
          background: "{primary.50}",
          focusBackground: "{primary.100}",
          color: "{primary.700}",
          focusColor: "{primary.800}"
        }
      },
      dark: {
        primary: {
          color: "{primary.400}",
          contrastColor: "{surface.900}",
          hoverColor: "{primary.300}",
          activeColor: "{primary.200}"
        },
        highlight: {
          background: "color-mix(in srgb, {primary.400}, transparent 84%)",
          focusBackground:
            "color-mix(in srgb, {primary.400}, transparent 76%)",
          color: "rgba(255,255,255,.87)",
          focusColor: "rgba(255,255,255,.87)"
        }
      }
    }
  }
};

and changed the theme

app.use(PrimeVue, {
  theme: {
    preset: myPresent,
    }
  }
});

The accent colour is correctly set but that of other elements, like surfaces or Toast messages, is completely gone.

How can one correctly set the theme colour on app load, as it would happen when clicking on a colour from the theme menu?

Thank you!

Set height and Width of spinner for responsive div elements

I am using CSS-grid responsible layout for web. The layout have three sections leftmenu, content and right.
For those sections I have to use spinners. The spinners width and height need to increased or decreased based on the size of those sections.
Can someone help either using css or javascript a good approach.

.container {
  display: grid;
  grid-template-areas:
    "header header header"
    "leftmenu content right"
    "footer footer footer";
  grid-template-columns: 1fr 4fr 1.5fr;
  grid-template-rows: 10vh 80vh 10vh;
  background-color: #2196F3;
  padding: 0px;
  gap: 10px;
  margin: 0px;
}

.container>div {
  background-color: rgba(255, 255, 255, 0.8);
  padding: 5px;
}

.container>div.header {
  grid-area: header;
  text-align: center;
}

.container>div.leftmenu {
  grid-area: leftmenu;
}

.container>div.content {
  grid-area: content;
}

.container>div.footer {
  grid-area: footer;
}

.container>div.right {
  grid-area: right;
}

/* Spinner */
.spinnerarea {
  width: 300px;
  height: 200px;
  background-color: white;
  position: absolute;
  top: 0px;
  opacity: 0.9
}

.spinnerarea>.spinner {
  border: 10px solid #f3f3f3;
  /* Light grey */
  border-top: 10px solid #3498db;
  /* Blue */
  border-radius: 50%;
  width: 10px;
  height: 10px;
  animation: spin 2s linear infinite;
  position: absolute;
  top: 45%;
  left: 45%;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }

  100% {
    transform: rotate(360deg);
  }
}
<body style="padding: 0px;margin: 0px;">
  <div class="container">
    <div class="header">
      <h2>My Header</h2>
    </div>
    <div class="leftmenu">
      <div class="spinnerarea" id="sparea">
        <div class="spinner"></div>
      </div><a href="#">Link 1</a><br><a href="#">Link 2</a><br><a href="#">Link 3</a>
    </div>
    <div class="content" style="overflow-y: auto;">
      <div class="spinnerarea" id="sparea">
        <div class="spinner"></div>
      </div>
      <h3>Content</h3>
      <p>Lorem ...
    </div>
    <div class="right">
      <div class="spinnerarea" id="sparea">
        <div class="spinner"></div>
      </div>
      <h4>Right</h4>
      <p>Right side content</p>
    </div>
    <div class="footer">
      <h4>Footer</h4>
    </div>

The github link is
https://github.com/reegan2024/Javascriptcss-grid/blob/main/css-grid.html

Include code in dev mode, but not in production in Vite.js site

I’m making a website using Vite.js and React.js. I do checks on the data in development mode. I use the zod library for this code. I can do this using the statement let zod = await import('zod'). This forces me to use async/await in the other code that renders the (mostly static) website and forces me to use a loader UI element (I didn’t test this yet). I would like a solution without async/await?

Options:

  • In my mind, the most logical place to solve this would be somewhere in the Vite.js bundler configuration. It could be possible to use a Vite.js plugin, that imports a file only in dev mode. I could use an extension like file.dev.ts or an option like ?dev to indicate it should only be imported in dev mode. A plugin might exist for this. I didn’t find one.
  • Maybe this is possible with other techniques.

Does anyone have a solution for this problem?

my vite + react app does not run after restarting my laptop

Click here to view error i get when i try to start app.
when i create my app and run it works fine but whenever i reopen this app after closing my laptop, it always show me this issue.i dont know why it is showing this.

i tried to delete node_modules and package-lock.json and reinstall them but even when i try to reinstall npm it shows errors too. i dont know why these issues are occuring i am new and just learning react but my app stops working next time i open it so i have to create new everytime.

Error i get while reinstalling npm for solving previous issue

How to get a screenshot from ReactPlayer

I am using react-player (from https://www.npmjs.com/package/react-player) and JavaScript (.tsx), and I want to have a screenshot (in a file or in a canvas) when I push a button.
I checked the documentation, but nothing is written there.
If I use the getInternalPlayer

This is my code attempt:

var canvas: HTMLCanvasElement = document.createElement("canvas");

canvas.width = video.getInternalPlayer().width;
canvas.height = video.getInternalPlayer().height;

console.log("captureVideoFrame passed first step ...");

if (playerRef.current)   canvas?.getContext('2d')?.drawImage(playerRef.current.getInternalPlayer().video, 0, 0);

but I get error on the last line:

Uncaught TypeError: Failed to execute 'drawImage' on 'CanvasRenderingContext2D': The provided value is not of type '(CSSImageValue or HTMLCanvasElement or HTMLImageElement or HTMLVideoElement or ImageBitmap or OffscreenCanvas or SVGImageElement or VideoFrame)'.
    at captureVideoFrame (Player.tsx:187:58)
    at myOnTimelineFileClickCallback (Player.tsx:135:9)
    at onFileClick (Timeline.tsx:2252:38)

Please advise how can I get this fixed?

Is there a way to remove buttons from the UI of Microsoft Copilot across multiple devices in a network

I am an English as a Second Language (ESL) instructor looking to make activities that utilize Microsoft Copilot to generate practice sentences for students. I use a text file with some parameters written in plain English to adjust the behavior of the LLM in the conversation and fine-tune it a little. This works very well, but a major issue is the auto-fill suggestions that Copilot provides above the text bar, which essentially give the answers to the student.

I use Copilot because it is connected to the Outlook account they receive from the school, and is easiest to monitor as the course instructor. I know there are models available online that don’t have this feature, but that gets messy having them create individual accounts and not being able to audit their conversation history.

I saw that the html has them as buttons, and on the user side I can delete them from being seen.

The class is in a computer lab, with computers that the students can log-in and be a part of the school network. Is there a way I can implement a script that deletes those buttons before they appear? I can receive permissions from the school IT department if necessary.

I used the inspect tool to look at the element, then used right click to delete the button on the UI. I do not have any experience with Java.

Why does TS remove JSDoc when creating type declaration file from JS file?

When I create a type declaration file (.d.ts) from a TypeScript file that includes JSDoc, the final type declaration file still contains the JSDoc. This is helpful, because the user of the package not only gets the types, but also the documentation.

When I create a type declaration file from a JS file that includes JSDoc, the final type declaration file only includes the type declaration, but no JSDoc. This means the user of the package gets types, but no documentation in the autocomplete.

Why is that or how can I persist the JSDoc?

TS understands the JSDoc enough to create the type declarations from JS, so it seems inconsistent that it wouldn’t include them in the final output.

A package that I’m aware of that generates the type declaration file from a JavaScript file while preserving JSDoc is Svelte, but I don’t understand how.

Fullcalendar prev and next custom button event calling

I have used FullCalendar within my project and I have add customization for calendar header to display like:
header={{ left: "prev", center: "title", right: "next" }}

Now, If i click on prev and next button, Month changes but I want to set month in header.

I am unable to get the month by clicking event.

I tried using basic javascript. After that for it to work I had to add month dropdown for selection of months. Can someone answer and help me out with this problem?

Insert nested tabset in an R Bookdown document

I found this question R Bookdown: Tabbed headings and the awesome answer from @linog which was the basis for my approach.

To show you what’s the purpose for my bookdown document, I have done this in r markdown too.
For the R markdown document you need library(rmarkdown), library(pandoc) and pandoc_activate(). You render it with: rmarkdown::render("C:/YourPath/tabset.Rmd")

The file tabset.Rmd

---
title: "Test Tabset"
date: "Last edited: `r format(Sys.time(), '%d.%m.%Y')`"
output: html_document
---

# City Trips {.tabset}

These are some sightseeing tips for the cities.

## London {.tabset}

Start your sightseeing in **London** now with these popular spots

### Buckingham Palace

Enjoy a glimpse into the life of royalty with...

### Tower of London

Explore the Tower of London and discover...

## Paris {.tabset}

Start your sightseeing in **Paris** now with these popular spots

### Eiffel Tower

The Eiffel Tower is the most famous landmark in the French capital...

```{r , echo=FALSE, eval=TRUE, fig.cap='Eiffel Tower', out.width='50%'}
knitr::include_graphics('images/Eiffel_Tower.png')
```

### Louvre Museum

Housing a vast collection of art spanning centuries and continents...

## Tokyo {.tabset}

Start your sightseeing in **Tokyo** now with these popular spots

### Shinjuku

Shinjuku is one of the 23 city wards of Tokyo, but the name...

### Edo-Tokyo Museum

The Edo-Tokyo Museum is housed in a unique looking building in the Ryogoku district...

In the single nested tabs I want to insert images like done with the Eiffel Tower but for simplicity I omitted these code snippets…

See the rendered result:

enter image description here

And now it’s my purpose to adopt that in my bookdown document.

The packages you need (and hopefully I have all of them listed): library(bookdown), library(knitr), library(markdown), library(rmarkdown), library(tinytex), library(htmltools) and library(pandoc) (with pandoc_activate() afterwards)

You render it with: bookdown::render_book("C:/YourPath/index.Rmd", output_format = "bookdown::gitbook")

The file index.Rmd

---
title: "Tabset in Bookdown"
date: "Last edited: `r format(Sys.time(), '%d.%m.%Y')`"
output:
  bookdown::gitbook:
   includes:
    in_header: header.html
   css: style.css
   number_sections: true
   anchor_sections: true
   split_by: "chapter"
   config:
     toc:
       collapse: section
       before: |
         <li><a href="./">Table of content</a></li>
---


# Test Tabset

<p>Click the Buttons:</p>

<div class="tab">
  <button class="tablinks" id="defaultOpen" data-target="London" onclick="openCity(event, 'London')">London</button>
  <button class="tablinks" data-target="Paris"  onclick="openCity(event, 'Paris')">Paris</button>
  <button class="tablinks" data-target="Tokyo"  onclick="openCity(event, 'Tokyo')">Tokyo</button>
</div>

<div id="London" class="tabcontent">
    Start your sightseeing in **London** now with these popular spots
</div>


<div id="Paris" class="tabcontent">
    Start your sightseeing in **Paris** now with these popular spots
    
    <div class="tab">
        <button class="tablinks" id="defaultOpenInner" data-target="Paris1"  onclick="openCity(event, 'Paris1')">Paris1</button>
        <button class="tablinks" data-target="Paris2"  onclick="openCity(event, 'Paris2')">Paris2</button>
    </div>

    <div id="Paris1" class="tabcontent">
        The Eiffel Tower is the most famous landmark in the French capital...
        
        ```{r, echo=FALSE, fig.cap='Eiffel Tower', out.width='70%'}
        knitr::include_graphics('images/Eiffel_Tower.png', dpi = NA)
        ```
        
    </div>

    <div id="Paris2" class="tabcontent">
        Housing a vast collection of art spanning centuries and continents...
        
        ```{r, echo=FALSE, fig.cap='Louvre Museum', out.width='70%'}
        knitr::include_graphics('images/Louvre_Museum.png', dpi = NA)
        ```
        
    </div>
  
  
</div>

<div id="Tokyo" class="tabcontent">
  Start your sightseeing in **Tokyo** now with these popular spots
</div>

# More Sections

With the CSS file (style.css)

/* CSS code just for the styling of the tabs */
/* Style the tab */
.tab {
  overflow: hidden;
  border: 1px solid #ccc;
  background-color: #f1f1f1;
}

/* Style the buttons inside the tab */
.tab button {
  background-color: inherit;
  float: left;
  border: none;
  outline: none;
  cursor: pointer;
  padding: 14px 16px;
  transition: 0.3s;
  font-size: 17px;
}

/* Change background color of buttons on hover */
.tab button:hover {
  background-color: #ddd;
}

/* Create an active/current tablink class */
.tab button.active {
  background-color: #ccc;
}

/* Style the tab content */
.tabcontent {
  display: none;
  padding: 6px 12px;
  border: 1px solid #ccc;
  border-top: none;
}

The header file (header.html)

<script>
window.openCity = function(evt, tabId) {
  var container = evt.currentTarget.closest(".tab").parentNode;

  // Hide content only within this container
  var tabcontent = container.querySelectorAll(".tabcontent");
  for (var i = 0; i < tabcontent.length; i++) {
    tabcontent[i].style.display = "none";
  }

  // Reset buttons only within this container
  var tablinks = container.querySelectorAll(".tablinks");
  for (var i = 0; i < tablinks.length; i++) {
    tablinks[i].classList.remove("active");
  }

  // Show the selected tab and set the corresponding button as active
  var el = document.getElementById(tabId);
  if (el) el.style.display = "block";
  if (evt && evt.currentTarget) evt.currentTarget.classList.add("active");
};

// Open the default tab on page load
document.addEventListener("DOMContentLoaded", function() {
  var defaultTabBtn = document.getElementById("defaultOpen");
  if (defaultTabBtn) {
    window.openCity({ currentTarget: defaultTabBtn }, defaultTabBtn.getAttribute("onclick").match(/'([^']+)'/)[1]);
  }
  // Optionally: also open the inner default tab
  var defaultInnerBtn = document.getElementById("defaultOpenInner");
  if (defaultInnerBtn) {
    window.openCity({ currentTarget: defaultInnerBtn }, defaultInnerBtn.getAttribute("onclick").match(/'([^']+)'/)[1]);
  }
});
</script>

And also the _bookdown.yml file

new_session: no
output_dir: "docs"
rmd_files: ["index.Rmd"]
language:
  label:
    fig: "Figure "

See the rendered result (separated by horizontal lines):

enter image description here

As you can see, it’s not that what I expect:

  • In tab London the content is like code
  • Also the Paris tab is like code
  • Only the Tokyo tab is as expected

Can you please help me to fix this issue with the aim, that the tabsets are nested, the images are shown and the London tab is shown correctly.

Many thanks in advance!

Menu Refreshing when everytime page loads [closed]

i had an issue that each and every time menu refreshes i want to stop the menu refreshing

I tried changing code in layoutuser.cshtml file but unable to achieve and files linked with it also i checked everytime need help from someone to diagnose the rootcause of the issue.I need solution immediately.i will share the file also please look that tell me the exact fix

Service worker stops intercepting img fetchs after a certain time in Firefox

I’m using my React app service worker to intercept certain fetchs to concatenate to their urls a token. It works good on the initial page load, but after a certain time, when I navigate the sw stops intercepting these fetchs.

What can I do to make the sw be woke up by these fetchs like it is for js fetchs ?
I know I can simply keep it alive by pinging it continually but I’m not a big fan of this option, it can have battery related drawback apparently.

Also, my fetched images are on a different domain than my app, but the content that contains it is on the app domain.

Here is my fetch event listener:

self.addEventListener("fetch", (event) => {
        let request = event.request;

        const url = new URL(request.url);

        if (
            token &&
            request.method === "GET" &&
            autoQSAuthorizationPaths.some((path) => request.url.startsWith(path))
        ) {
            url.searchParams.set("authorization", token);
            request = new Request(url.toString(), request);
        }

        event.respondWith(fetch(request));
    });

Here is my sw registration in my app:

const registration = await navigator.serviceWorker.register("/sw.js", {
    type: "module",
    scope: "/",
});

await registration.update();

await navigator.serviceWorker.ready;

Here is my sw install and activate event listeners:

self.addEventListener("install", (event) => {
    const func = async () => {
        if (!isDev) {
            await precache();
        }
        self.skipWaiting();
    };

    event.waitUntil(func());
});
self.addEventListener("activate", (event) => {
    const func = async () => {
        if (!isDev) {
            await clearOldCaches();
        }
        await self.clients.claim();
    };

    event.waitUntil(func());
});

I tried to use this hook that I created to keep the sw alive while I’m on the app page, I revive it if I come back to the page after lefting it:

self.addEventListener("install", (event) => {
    const func = async () => {
        if (!isDev) {
            await precache();
        }
        self.skipWaiting();
    };

    event.waitUntil(func());
});
self.addEventListener("activate", (event) => {
    const func = async () => {
        if (!isDev) {
            await clearOldCaches();
        }
        await self.clients.claim();
    };

    event.waitUntil(func());
});

But, when my app is inactive and I come back to it. If the sw had been killed by Firefox during this time, the ping don’t revive it.

Woocommerce Product Variant

I am not getting solution,in wocommerce site i have addred product like HOODIES which has two sizes Youth|Adult Youth Size has two color option White|Grey and Adult has White|Grey|Red I want is as user select Youth Sizefrom drop down only White| Grey appears and when select Adult all White|Grey|Red appear. I don’t want to use any plugin. Can it be possible ?