Questions tagged [lightning-web-components]

This tag is for questions related to JavaScript, CSS, or Markup when used in the Lightning Web Component (LWC) programming model, or for questions of interoperability between LWC and the original Aura-based lightning components.

1,652 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
2
votes
0answers
42 views

What is a typical JavaScript code coverage for LWCs (Lightning Web Components) that are adequately tested via JEST?

I know this might get closed as being a matter of opinion, but as long as those opinions are based on actual experience, such answers are valuable to me, particularly if they are somewhat consistent. ...
2
votes
1answer
94 views

Focus method not working for lightning-input

We have a LWC that is deployed to production and working fine. The LWC contains only a lightning-input component and some JS. The LWC is used on a screen flow. The main purpose of the LWC is to ...
2
votes
1answer
99 views

Open Record Specific LWC Subtab

I am trying to get a Lightning Web Component to open a new subtab containing another Lightning Web Component. Our team has already established a hidden utility bar component which listens for post ...
2
votes
0answers
141 views

Lwc components are visible on record page but in flexiPage.xml it is not there

Lwc components are visible on record page but in flexiPage.xml it is not there. I have updated the package.xml to latest 51 version but issue is still there. When I add an aura component, it reflects ...
2
votes
1answer
109 views

Lightning App Builder xml retrieve problem summer '21

after the Summer '21 release we have noticed that when we are trying to retrieve a flexipage that contains few lightning-web-component, all of these are removed from the retrieved manifest. This ...
2
votes
1answer
126 views

Error: Unknown public property “name” of element <LIGHTNING-INPUT-FIELD>. This is likely a typo on the corresponding attribute “name”

I am getting this issue in the console: Error: Unknown public property "name" of element . This is likely a typo on the corresponding attribute "name". However, this component was ...
2
votes
0answers
146 views

Custom Lightning Web Component not available in Experience Builder / Lightning App Builder

I have a simple LWC banner component that displays a banner in an Experience Builder page, based on certain conditions. banner.html <template> <template if:true={bannerUrl}> &...
2
votes
0answers
222 views

Example of LWC Custom Flow Navigation Footer

Does anyone know of a sample LWC that can be used as a custom navigation footer for a Screen Flow? I'm looking through blog posts and forums and am finding all Aura components. Thanks
2
votes
0answers
30 views

Why is lightning-input-field programmatically rerender only in async change-value function?

I am developing this feature that validate a user's input value of a look-up field and decide to clear it or not. <lightning-input-field field-name="LOOK_UP__c" value={lookUpValue} ...
2
votes
0answers
35 views

How to make lightning-layout-item grow horizontally or vertically or both?

I'm trying to create a flexible layout using lightning-layout and lightning-layout-item base components in LWC. The screenshot of the basic idea is given below. Appreciate inputs on how can we achieve ...
2
votes
0answers
26 views

Aura component and LWC are not supporting Nepal locale

I have a requirement where I need to show date in Nepal locale in both Lightning Web and Aura components. This shows the date in, for example - २०२१/२/१७ format in Salesforce but on LWC and Aura, it ...
2
votes
0answers
196 views

Odd Error Returned When Using Lightning Message Service in LWC - WindowMessengerNoConnectionError

This is my first time using Lightning Message Service. I set it up following the directions on this standard documentation page. After setting this up I am able to communicate between two lightning ...
2
votes
0answers
46 views

How to Mock getRecordNotifyChange

How exactly do we mock getRecordNotifyChange in a JEST test? I cannot find an example anywhere.
2
votes
0answers
161 views

Lightning Datatable :: Enable Editing without inline editing

I have an LWC component which uses lightning Datatable i.e., Edit Values(A). This is embedded in Read Only mode in an Aura component which we display on the Opportunity object. There is inline editing ...
2
votes
0answers
449 views

Test Class for LWC Component

I have a LWC Component which is used for record upload process. Below is my LWC Javascript code: import { LightningElement, api } from 'lwc'; import file1 from '@salesforce/apex/customLwcController....
2
votes
0answers
194 views

How subscribe to a standard LWC components message channel

I have been able to get the message channel functionality working for my LWC components. I can have multiple custom components on the same page and they are able to talk to each other without a ...
2
votes
0answers
521 views

Adding toolTip on mouse hover of info icon in LWC datatable result

I want to add tooltip to a particular column value of data table on mouse hover. I tried with URL type but the the column value should now be clickable. So I decided to add a info icon and tried to ...
2
votes
1answer
199 views

LWC Progress Ring: Unable to set ring content

Using SLDS you can set some content in a Progress Ring <div class="slds-progress-ring slds-progress-ring_large"> <div class="slds-progress-ring__progress" role="...
2
votes
0answers
236 views

Close Toast Message with messageData on hyperlink click - lwc

I have a toast message in lwc that uses sticky mode (does not go away until the user click on close symbol) and also messageData (to add a hyperlink in the toast for the user to click on). The thing ...
2
votes
0answers
155 views

default wraptext for lightning-tree-grid cell

I see there is a wrapText by default support for datatables in Aura and LWC. Would like to post this question on a broader platform and see if there is a way to default wrapText in lightning-tree-grid ...
2
votes
0answers
109 views

Adding multiple apex-controllers on a manifest.json file of a react app

I have a react app that is built and added as a static resource to a lighting component. This react app uses calls to apex (LCC.callApex) to get certain necessary data. For the app to be able to ...
2
votes
0answers
742 views

How to write jest test for lightning-datatable LWC

I'm populating the data table in the jest test successfully but when I try to select any row it comes up null which leads to this error TypeError: dataTableRow.click is not a function this is from my ...
2
votes
2answers
534 views

Calling another Salesforce org via REST from LWC

I want to make rest api callout (to same salesforce org) without apex i.e. from LWC using Javascript (fetch, xhr). I have created a Named credential for making callout. And I am trying to upload file ...
2
votes
1answer
144 views

Make wrapper attribute reactive in LWC

I will elaborate more than necessary on the issue i am facing, so that if i there is an entirely better approach to implement what i am doing, someone can suggest that. I am building a lightning ...
2
votes
1answer
76 views

design attributes type for array of object

Similar to how we define type for properties in targetconfigs as: <property name="strTitle" type="String" default="Welcome in Salesforce" label="Enter the title&...
2
votes
0answers
356 views

Lightning Message service error in visualforce page - Cannot read property 'subscribe' of undefined

Was anybody able to work with sforce.one.subscribe for subscribing to lightning message service in visualforce? I keep getting below error: Even after including sforce and ajax js files, sforce.one ...
2
votes
0answers
170 views

Bootstrap navbar does not expand/collapse in LWC

I used the bootstrap navbar in LWC component. While the look and feel works, i could not get the menubar to expand/collapse when screen size is shrunk. Below is the code snippet. The relevant ...
2
votes
0answers
33 views

How to pre-load and share a 3rd party JavaScript library across multiple LWCs?

This example of using D3 combines the loadScript in the connectedCallback with the code that uses D3, initializeD3 here: renderedCallback() { ... Promise.all([ loadScript(this, D3 + '/...
2
votes
0answers
140 views

TypeError with Select2 script in Lightning Web Component

When I use the third-party library select2.js in a lightning web component, the console throw an error: TypeError: Illegal invocation on column 9251 in select2.min.js : `r.call(e.element,":...
2
votes
0answers
895 views

Adding Chatter to an LWC Component

I have a composite LWC component which has several child LWC components and I would like to add a Chatter feed related to my SObject (Account in this case) as another child, and be able to pass in my ...
2
votes
1answer
295 views

New Lightning component with custom 'Send to chat' button

we have a basic lightning component that is generating a link, we would like to add a new button to send directly this content to the standard chat component, without agent interaction. Something like ...
2
votes
0answers
547 views

Why my function in connectedCallback is called twice and not following the order

I am still in journey to understand on how LWC works . I read some doc and try to do poc , so i am really apologize if my question is not proper to be asked. Feel free to devote it =) Note : ...
2
votes
1answer
201 views

Lightning Out LWC File Not Found?

I know I'm not the first person to ask about this, but I have yet to find a solution to fix it. Problem: I'm receiving a 404 error (file not found) when trying to load a lightning web component via ...
2
votes
0answers
96 views

Lightning input type file issue in IE11

I am using a lightning-input type="file and customizing it's look and feel. <lightning-input type="file" onchange={handleFilesChange} class="fileUpload ts-attach"> </lightning-input> By ...
2
votes
0answers
114 views

How to pass record id to the Emp API Lightning Web Component?

In my Aura implementation of Emp API, I could pass the record Id I want to listen for changes to like this: empApi.subscribe("/topic/AllLeadChanges?Id=" + component.get("v.recordId"), -1, function(...
2
votes
1answer
581 views

LWC - How do we get Draft value of Custom Lookup in the Data Table?

I'm currently trying to do a mass update of records through the Data Table that includes inline editing. As I understand it's not currently supported natively for Lookups in the Data Table. I ...
2
votes
0answers
277 views

Calling this[NavigationMixin.Navigate] re-initializes the component

I have a parent component that handles the navigation for my app and a child component that loads a list of data. Whenever I call this[NavigationMixin.Navigate] it re-initializes the entire parent ...
2
votes
1answer
258 views

refreshApex in Lightning Web Components is not working

In Custom Object i have new tab with lightning Input, On Save the Form value we need to Display the data in data table. Data is saving in my object, But Data-table is not refreshing with new data. I'...
2
votes
1answer
1k views

Unable to Close Drop down menu on Outside click in LWC

I am unable to close the dropdown menu in LWC on clicking anywhere else on the page apart from the dropdown menu . Please find the code below , HTML Code : <a class="userStyle" role="button" ...
2
votes
1answer
563 views

Unable to Communicate between components on different pages using Lightning message channel

I'm using Lightning Message Channel to communicate between components on 2 different Pages and it's not working. The communication works when I put both these components on the same page. Can ...
2
votes
0answers
261 views

Lightning Knowledge component is not refreshed when the case changed programatically

In the detail page below, the standard Knowledge component is properly refreshed when I change the "Verbatim (English Language)" field through the UI. However, if I change the value of "Verbatim (...
2
votes
0answers
278 views

Any way to scale (zoom) whole Lightning component based Community pages?

We have an internal debate that for a specific Community application, the standard font sizes are too small. So the ideal would be to scale the whole page of content whatever namespace the content is ...
2
votes
0answers
71 views

LWC: Record Id format when chaining wired properties?

The Understanding Wire Service doc says the following: You can use one @wire output as another @wire input. For example, you could use $record.data.fieldName as an input to another wire adapter. ...
2
votes
0answers
138 views

document.title not returning correct value when used in LWC

I am using JS: document.title to get the page title value of article detail page in a community page which displays Knowledge articles, but it is sometimes returning: Article Detail Rather than ...
2
votes
0answers
268 views

How to make the “Skip to Main Content” accessibility links work for a Community?

See What is "Skip to main content"? or e.g. Skip to main content for some background on this mechanism. It helps keyboard-only users. These links are automatically present in our LWC-based ...
2
votes
1answer
894 views

Unable to update tracked array in LWC

For some reason, the push in the code block below is not updating the array. The console.log statement displays the array with 0 elements. I created a local array variable and pushed to it with no ...
2
votes
0answers
931 views

How to iterate javascript objects key-value pairs in salesforce LWC

I am new to LWC and I want to iterate over javascript objects key-value pair in LWC. The keys in object are dynamic. As LWC iteration doesn't allow computed expression like Obj[key], is there is ...
2
votes
0answers
150 views

LWC download ContentDocument with alternative name

I have a LWC component where i render some ContentDocument information. If the user goes to /sfc/servlet.shepherd/version/download/ContentDocument.LatestPublishedVersionId (e.g. by clicking on a ...
2
votes
2answers
3k views

[LWC]: How to insert value as HTML not Text from Javascript

I am trying to dynamically populate HTML elements in my LWC. However it is showing as text, escaping the HTML characters. I tried using <lightning-formatted-rich-text> but that is also not ...
2
votes
1answer
923 views

While I am trying to deploy LWC component I am getting error as “Value too long for field” in VS code.Does anyone have solution for this

force-app\main\default\lwc\sampleLWC\sampleLWC.js-meta.xml Failed to save Lightning Component Resource [lwc/sample/sample.js] of Lightning Component Bundle [sampleLWC]. Error: Value too long for ...

1 2
3
4 5
34