Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SplitButton without text throws error #4609

Closed
1 of 4 tasks
MarcusNotheis opened this issue Jan 21, 2022 · 0 comments · Fixed by #4612
Closed
1 of 4 tasks

SplitButton without text throws error #4609

MarcusNotheis opened this issue Jan 21, 2022 · 0 comments · Fixed by #4612
Assignees
Labels
bug This issue is a bug in the code High Prio

Comments

@MarcusNotheis
Copy link
Collaborator

Bug Description

If a use a ui5-split-button without a text (e.g. just an icon), a JS error is thrown.

Expected Behavior

No error should be thrown

Steps to Reproduce

  1. Open https://codesandbox.io/s/great-rgb-q7umb?file=/src/App.js

Isolated Example

https://codesandbox.io/s/great-rgb-q7umb?file=/src/App.js

Context

  • UI5 Web Components version: 1.1.0
  • OS/Platform: macOS 12.1
  • Browser: Chrome
  • Affected component: ui5-split-button

Log Output / Stack Trace / Screenshots

image

SplitButton.js:392 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'textContent')
    at SplitButton.get (SplitButton.js:392:1)
    at block0 (SplitButtonTemplate.lit.js:4:1)
    at executeTemplate (executeTemplate.js:14:1)
    at updateShadowRoot (updateShadowRoot.js:17:1)
    at SplitButton._render (UI5Element.js:576:1)
    at renderImmediately (Render.js:40:1)
    at SplitButton.connectedCallback (UI5Element.js:122:1)

Priority

  • Low
  • Medium
  • High
  • Very High
@ilhan007 ilhan007 added the bug This issue is a bug in the code label Jan 22, 2022
@ilhan007 ilhan007 self-assigned this Jan 23, 2022
ilhan007 added a commit that referenced this issue Jan 24, 2022
When the default slot is empty, e.g no text is provided, the this.text[0].textContent throws an error.
Instead, call to this.textContent is sufficient.

Fixes: #4609
@petyabegovska petyabegovska moved this to Completed in Maintenance - Topic B Jun 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue is a bug in the code High Prio
Projects
Status: Completed
Development

Successfully merging a pull request may close this issue.

4 participants